25 #include <Classes.hpp>
26 #include <Controls.hpp>
27 #include <StdCtrls.hpp>
29 #include <Buttons.hpp>
30 #include <ExtCtrls.hpp>
32 #include <Dialogs.hpp>
33 #include <Graphics.hpp>
34 #include <ComCtrls.hpp>
50 #pragma package(smart_init)
63 Graphics::TBitmap* SmallGraphicPtrVal) : SpeedTag(SpeedTagVal), TrackType(TrackTypeVal), GraphicPtr(GraphicPtrVal), SmallGraphicPtr(SmallGraphicPtrVal)
65 for(
int x = 0; x < 4; x++)
76 else if(SpeedTagVal == 77)
80 else if(SpeedTagVal == 78)
84 else if(SpeedTagVal == 79)
88 else if(SpeedTagVal == 96)
92 else if(SpeedTagVal == 129)
96 else if(SpeedTagVal == 130)
100 else if(SpeedTagVal == 131)
104 else if(SpeedTagVal == 145)
108 else if(SpeedTagVal == 146)
117 FixedNamedLocationElement(false)
119 for(
int x = 0; x < 4; x++)
130 AnsiString(VLocInput));
143 if((this->
HLoc == RHElement.
HLoc) && (this->VLoc == RHElement.
VLoc) && (this->SpeedTag == RHElement.
SpeedTag))
157 if((this->
HLoc != RHElement.
HLoc) || (this->VLoc != RHElement.
VLoc) || (this->SpeedTag != RHElement.
SpeedTag))
173 Graphics::TBitmap *GraphicOutput = GraphicPtr;
175 if(LocationName ==
"")
220 GraphicOutput = GraphicPtr;
224 Disp->PlotOutput(34, HLoc * 16, VLoc * 16, GraphicOutput);
226 if((TrackType ==
Simple) && Failed)
238 AnsiString LogString =
"TrkEl:-," + AnsiString(ElementID) +
"," + LocationName +
"," + AnsiString(TrainIDOnElement) +
"," +
239 AnsiString(TrainIDOnBridgeOrFailedPointOrigSpeedLimit01) +
"," + AnsiString(TrainIDOnBridgeOrFailedPointOrigSpeedLimit23) +
",EndTrkEl,";
248 Attribute(0), CallingOnSet(false), Length01(
Utilities->DefaultTrackLength), Length23(-1), SpeedLimit01(
Utilities->DefaultTrackSpeedLimit), SpeedLimit23(-1),
249 TrainIDOnElement(-1), TrainIDOnBridgeOrFailedPointOrigSpeedLimit01(-1), TrainIDOnBridgeOrFailedPointOrigSpeedLimit23(-1), StationEntryStopLinkPos1(-1),
250 StationEntryStopLinkPos2(-1), StationEntryStopLinkPos3(-1), StationEntryStopLinkPos4(-1), SigAspect(FourAspect)
253 for(
int x = 0; x < 4; x++)
269 if(lower.second < higher.second)
273 else if(lower.second > higher.second)
277 else if(lower.second == higher.second)
279 if(lower.first < higher.first)
292 :
TTrackElement(ElementIn), ELink(ELinkIn), ELinkPos(ELinkPosIn), XLink(XLinkIn), XLinkPos(XLinkPosIn), TrackVectorPosition(TrackVectorPositionIn),
293 CheckCount(9), IsARoute(false), AutoSignals(false), PrefDirRoute(false)
297 throw Exception(
"EXNumber failure in TPrefDirElement constructor");
308 AnsiString LogString =
"PthEl:-," + AnsiString(
ELink) +
"," + AnsiString(
ELinkPos) +
"," + AnsiString(
XLink) +
"," + AnsiString(
XLinkPos) +
"," +
336 {2, 4}, {6, 2}, {8, 6}, {4, 8},
337 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
347 else if(
Link[2] == -1)
360 else if(
Link[2] == -1)
369 for(
int x = 0; x < 16; x++)
371 if(((Entry == EXArray[x][0]) && (Exit == EXArray[x][1])) || ((Entry == EXArray[x][1]) && (Exit == EXArray[x][0])))
547 throw Exception(
"Error in EntryExitNumber 4");
642 throw Exception(
"Error in EntryExitNumber 5");
736 throw Exception(
"Error in EntryExitNumber 6");
823 throw Exception(
"Error in EntryExitNumber 10");
912 throw Exception(
"Error in EntryExitNumber 11");
1008 throw Exception(
"Error in EntryExitNumber 7");
1039 throw Exception(
"Error in EntryExitNumber 8");
1050 if((ELink > 0) && (ELink < 10) && (ELink != 5))
1052 if(!AutoSigsFlag && !PrefDirRoute)
1056 else if(!AutoSigsFlag && PrefDirRoute)
1067 throw Exception(
"Error in EntryExitNumber 9");
1164 AnsiString NL =
'\n';
1166 RouteFailMessage =
"Unable to set a route:" + NL + NL +
"it may be unreachable, perhaps because of failed points; " + NL + NL +
1167 "reachable but too far ahead or with too many different directions leading away from the start point - set some points on the route required; " + NL + NL +
1168 "blocked by a train, another route or a changing level crossing; " + NL + NL +
1169 "or invalid - possibly due to a preferred direction mismatch, or a missed signal in a blue route or green route restricted to consecutive signals.";
1178 int InternalLinkCheckArray[9][2] =
1179 {{1, 9}, {4, 6}, {7, 3}, {2, 8}, {0, 0}, {8, 2}, {3, 7}, {6, 4}, {9, 1}};
1184 for(
int x = 0; x < 9; x++)
1186 for(
int y = 0; y < 2; y++)
1193 TopPlatAllowed << 1 << 9 << 10 << 30 << 31 << 60 << 61 << 68 << 69 << 77 << 125 << 126 << 129 << 145;
1195 BotPlatAllowed << 1 << 7 << 8 << 28 << 29 << 60 << 61 << 68 << 69 << 76 << 125 << 126 << 129 << 145;
1196 LeftPlatAllowed << 2 << 12 << 14 << 33 << 35 << 62 << 63 << 70 << 71 << 79 << 127 << 128 << 130 << 146;
1197 RightPlatAllowed << 2 << 11 << 13 << 32 << 34 << 62 << 63 << 70 << 71 << 78 << 127 << 128 << 130 << 146;
1198 NameAllowed << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12 << 13 << 14 << 15 << 16 << 18 << 19 << 20 << 21 << 22 << 23 << 24
1199 << 25 << 26 << 27 << 28 << 29 << 30 << 31 << 32 << 33 << 34 << 35 << 36 << 37 << 38 << 39 << 40 << 41 << 42 << 43 << 44 << 45 << 46 << 47
1200 << 60 << 61 << 62 << 63 << 64 << 65 << 66 << 67 << 68 << 69 << 70 << 71 << 72 << 73 << 74 << 75 << 80 << 81 << 82 << 83 << 84 << 85 << 86
1201 << 87 << 125 << 126 << 127 << 128 << 132 << 133 << 134 << 135 << 136 << 137 << 138 << 139
1202 << 140 << 141 << 142 << 143;
1207 int HVArray[10][2] =
1208 {{0, 0}, {-1, -1}, {0, -1}, {1, -1}, {-1, 0}, {0, 0}, {1, 0}, {-1, 1}, {0, 1}, {1, 1}};
1210 for(
int x = 0; x < 10; x++)
1212 for(
int y = 0; y < 2; y++)
1221 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1224 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
1225 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
1227 {68, 2,
RailGraphics->
bm68dblyellow}, {69, 2,
RailGraphics->
bm69dblyellow}, {70, 2,
RailGraphics->
bm70dblyellow}, {71, 2,
RailGraphics->
bm71dblyellow},
1228 {72, 2,
RailGraphics->
bm72dblyellow}, {73, 2,
RailGraphics->
bm73dblyellow}, {74, 2,
RailGraphics->
bm74dblyellow}, {75, 2,
RailGraphics->
bm75dblyellow},
1230 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1231 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1234 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1237 for(
int x = 0; x < 40; x++)
1243 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1246 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
1247 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
1249 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
1250 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
1252 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1253 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1256 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1259 for(
int x = 0; x < 40; x++)
1265 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1268 {68, 1,
RailGraphics->
bm68green}, {69, 1,
RailGraphics->
bm69green}, {70, 1,
RailGraphics->
bm70green}, {71, 1,
RailGraphics->
bm71green},
1269 {72, 1,
RailGraphics->
bm72green}, {73, 1,
RailGraphics->
bm73green}, {74, 1,
RailGraphics->
bm74green}, {75, 1,
RailGraphics->
bm75green},
1271 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
1272 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
1274 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1275 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1278 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1281 for(
int x = 0; x < 40; x++)
1307 for(
int x = 0; x < 40; x++)
1313 {{68, 0,
RailGraphics->
FSig68}, {69, 0,
RailGraphics->
FSig69}, {70, 0,
RailGraphics->
FSig70}, {71, 0,
RailGraphics->
FSig71}, {72, 0,
RailGraphics->
FSig72},
1316 for(
int x = 0; x < 8; x++)
1322 {{68, 0,
RailGraphics->
FGSig68}, {69, 0,
RailGraphics->
FGSig69}, {70, 0,
RailGraphics->
FGSig70}, {71, 0,
RailGraphics->
FGSig71}, {72, 0,
RailGraphics->
FGSig72},
1325 for(
int x = 0; x < 8; x++)
1352 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1353 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1354 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {0, 0, 77}, {-1, 0, 78},
1355 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1356 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, -1, 129},
1357 {0, 0, 129}, {0, -1, 145},
1360 for(
int x = 0; x < 25; x++)
1362 for(
int y = 0; y < 3; y++)
1370 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1371 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {0, 0, 76}, {-1, 0, 77},
1372 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1373 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1374 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1375 {0, 0, 129}, {0, 1, 145},
1378 for(
int x = 0; x < 25; x++)
1380 for(
int y = 0; y < 3; y++)
1388 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1389 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1390 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1391 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1392 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 0, 79}, {-1, 0, 130},
1393 {0, 0, 130}, {-1, 0, 146},
1396 for(
int x = 0; x < 25; x++)
1398 for(
int y = 0; y < 3; y++)
1406 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1407 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1408 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1409 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {0, 0, 78}, {-1, 0, 79},
1410 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {1, 0, 130},
1411 {0, 0, 130}, {1, 0, 146},
1414 for(
int x = 0; x < 25; x++)
1416 for(
int y = 0; y < 3; y++)
1424 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1425 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1426 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1427 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1428 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1429 {0, -1, 129}, {1, 0, 130},
1430 {-1, 0, 130}, {0, 1, 145},
1431 {0, -1, 145}, {1, 0, 146},
1434 for(
int x = 0; x < 28; x++)
1436 for(
int y = 0; y < 3; y++)
1454 for(
int x = 0; x < 8; x++)
1456 for(
int y = 0; y < 3; y++)
1474 for(
int x = 0; x < 8; x++)
1476 for(
int y = 0; y < 3; y++)
1494 for(
int x = 0; x < 8; x++)
1496 for(
int y = 0; y < 3; y++)
1514 for(
int x = 0; x < 8; x++)
1516 for(
int y = 0; y < 3; y++)
1524 {1, 0, 131}, {0, -1, 131}, {0, 1, 131}};
1526 for(
int x = 0; x < 4; x++)
1528 for(
int y = 0; y < 3; y++)
1536 0, 1, 2, 5, 6, 3, 4, 9, 10, 7, 8, 13, 14, 11, 12, 15, 16, 17, 19, 18, 22, 23, 20, 21, 26, 27, 24, 25, 30, 31, 28, 29, 34, 35, 32, 33, 38, 39, 36, 37, 42,
1537 43, 40, 41, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 60, 61, 63, 62, 66, 67, 64, 65, 68, 69, 71, 70, 74, 75, 72, 73, 77, 76, 78,
1538 79, 80, 81, 83, 82, 86, 87, 84, 85, 88, 89, 91, 90, 94, 95, 92, 93, 96, 99, 100, 97, 98, 103, 104, 101, 102, 106, 105, 109, 110, 107, 108, 113, 114,
1539 111, 112, 117, 118, 115, 116, 119, 120, 121, 123, 122, 124, 125, 126, 128, 127, 129, 130, 131, 134, 133, 132, 135, 139, 138, 137, 136, 143, 142, 141,
1545 0, 1, 2, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 15, 16, 17, 19, 18, 21, 20, 23, 22, 25, 24, 27, 26, 29, 28, 31, 30, 33, 32, 35, 34, 37, 36, 39, 38, 41,
1546 40, 43, 42, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 61, 60, 62, 63, 65, 64, 67, 66, 69, 68, 70, 71, 73, 72, 75, 74, 76, 77, 79,
1547 78, 81, 80, 82, 83, 85, 84, 87, 86, 89, 88, 90, 91, 93, 92, 95, 94, 96, 98, 97, 100, 99, 102, 101, 104, 103, 106, 105, 108, 107, 110, 109, 112, 111,
1548 114, 113, 116, 115, 118, 117, 119, 120, 124, 122, 123, 121, 126, 125, 127, 128, 129, 130, 131, 132, 135, 134, 133, 137, 136, 139, 138, 142, 143, 140,
1554 0, 2, 1, 4, 6, 3, 5, 14, 12, 13, 11, 7, 9, 8, 10, 15, 16, 17, 19, 18, 25, 27, 24, 26, 21, 23, 20, 22, 35, 33, 34, 32, 28, 30, 29, 31, 41, 43, 40, 42, 37,
1555 39, 36, 38, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 63, 62, 60, 61, 65, 67, 64, 66, 71, 70, 68, 69, 73, 75, 72, 74, 79, 78, 76,
1556 77, 83, 82, 80, 81, 85, 87, 84, 86, 91, 90, 88, 89, 93, 95, 92, 94, 96, 102, 104, 101, 103, 98, 100, 97, 99, 106, 105, 108, 110, 107, 109, 116, 118,
1557 115, 117, 112, 114, 111, 113, 120, 119, 122, 124, 121, 123, 127, 128, 126, 125, 130, 129, 131, 133, 134, 135, 132, 137, 138, 139, 136, 143, 142, 140,
1563 0, 2, 1, 5, 3, 6, 4, 11, 13, 12, 14, 10, 8, 9, 7, 15, 16, 17, 19, 18, 26, 24, 27, 25, 22, 20, 23, 21, 32, 34, 33, 35, 31, 29, 30, 28, 42, 40, 43, 41, 38,
1564 36, 39, 37, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 62, 63, 61, 60, 66, 64, 67, 65, 70, 71, 69, 68, 74, 72, 75, 73, 78, 79, 77,
1565 76, 82, 83, 81, 80, 86, 84, 87, 85, 90, 91, 89, 88, 94, 92, 95, 93, 96, 103, 101, 104, 102, 99, 97, 100, 98, 106, 105, 109, 107, 110, 108, 117, 115,
1566 118, 116, 113, 111, 114, 112, 120, 119, 123, 121, 124, 122, 128, 127, 125, 126, 130, 129, 131, 135, 132, 133, 134, 139, 136, 137, 138, 142, 143, 141,
1588 delete UGMIt->second;
1664 Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
1665 Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
1667 Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
1674 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1675 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1688 {4, 6, -1, -1}, {2, 8, -1, -1}, {6, 8, -1, -1}, {4, 8, -1, -1}, {2, 6, -1, -1}, {2, 4, -1, -1},
1689 {4, 6, 4, 2}, {6, 4, 6, 2}, {4, 6, 4, 8}, {6, 4, 6, 8}, {8, 2, 8, 4}, {8, 2, 8, 6}, {2, 8, 2, 4}, {2, 8, 2, 6},
1691 {4, 6, 2, 8}, {1, 9, 3, 7},
1693 {3, 7, -1, -1}, {1, 9, -1, -1}, {7, 6, -1, -1}, {4, 9, -1, -1}, {1, 6, -1, -1}, {4, 3, -1, -1}, {3, 8, -1, -1}, {1, 8, -1, -1}, {2, 9, -1, -1},
1695 {4, 6, 4, 3}, {6, 4, 6, 1}, {4, 6, 4, 9}, {6, 4, 6, 7}, {8, 2, 8, 1}, {8, 2, 8, 3}, {2, 8, 2, 7}, {2, 8, 2, 9}, {9, 1, 9, 2}, {7, 3, 7, 2}, {3, 7, 3, 8}, {1, 9, 1, 8}, {9, 1, 9, 4}, {7, 3, 7, 6}, {3, 7, 3, 4}, {1, 9, 1, 6},
1698 {1, 9, 2, 8}, {2, 8, 3, 7}, {4, 6, 3, 7}, {1, 9, 4, 6},
1699 {2, 8, 4, 6}, {4, 6, 2, 8}, {3, 7, 1, 9}, {1, 9, 3, 7}, {2, 8, 1, 9}, {2, 8, 3, 7}, {3, 7, 2, 8}, {1, 9, 2, 8}, {4, 6, 3, 7}, {4, 6, 1, 9}, {1, 9, 4, 6}, {3, 7, 4, 6},
1700 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1701 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1},
1702 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1703 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1704 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1706 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1707 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1708 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1709 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1710 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1},
1711 {4, 6, -1, -1}, {2, 8, -1, -1},
1713 {8, 1, 8, 3}, {4, 3, 4, 9}, {2, 9, 2, 7}, {6, 7, 6, 1}, {9, 4, 9, 2}, {7, 2, 7, 6}, {1, 6, 1, 8}, {3, 8, 3, 4},
1715 {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1}, {1, 9, -1, -1},
1717 {4, 6, -1, -1}, {2, 8, -1, -1},
1722 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1723 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1724 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1725 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1728 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1729 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1730 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1732 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1733 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1734 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1736 {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn},
1738 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1739 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1740 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1741 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1742 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1743 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1744 {
Connection,
Signal,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet},
1745 {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet},
1746 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1747 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1748 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1749 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1750 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1752 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1753 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1754 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1755 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1756 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1757 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1758 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1759 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1763 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1764 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1765 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1771 for(
int x = 0; x < 17; x++)
1773 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1775 FixedTrackPiece[17] =
TFixedTrackPiece(17, TrackTypeArray[17], Links[17], Configs[17], 0, 0);
1779 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1785 ExistingGraphicLoaded(false), Width(16), Height(16)
1797 ExistingGraphicLoaded(false), Width(WidthIn), Height(HeightIn)
1835 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalScreenGraphic()");
1839 throw Exception(
"Overlay not 16x16 in TGraphicElement::LoadOriginalScreenGraphic()");
1843 throw Exception(
"Source not set in TGraphicElement::LoadOriginalScreenGraphic()");
1847 throw Exception(
"ExistingGraphicLoaded in TGraphicElement::LoadOriginalScreenGraphic()");
1870 AnsiString(VOffset) +
"," + AnsiString(WidthIn) +
"," + AnsiString(HeightIn));
1873 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalExistingGraphic()");
1877 throw Exception(
"Source not set in TGraphicElement::LoadOriginalExistingGraphic()");
1881 throw Exception(
"ScreenGraphicLoaded in TGraphicElement::LoadOriginalExistingGraphic()");
1915 throw Exception(
"Overlay not loaded in TGraphicElement::PlotOverlay()");
1936 throw Exception(
"Original not loaded in TGraphicElement::PlotOriginal()");
1950 bool TrackPresent =
false;
1964 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1968 TrackPresent =
true;
1973 return(!TrackPresent);
1981 bool TrackPresent =
false;
1990 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1994 TrackPresent =
true;
2000 return(!TrackPresent);
2005 void TTrack::EraseTrackElement(
int Caller,
int HLocInput,
int VLocInput,
int &ErasedTrackVectorPosition,
bool &TrackEraseSuccessfulFlag,
bool InternalChecks)
2008 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2009 TrackEraseSuccessfulFlag =
false;
2014 ErasedTrackVectorPosition = -1;
2015 AnsiString SName =
"", ErrorString;
2017 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
2023 TrackMapKeyPair.first = HLocInput;
2024 TrackMapKeyPair.second = VLocInput;
2025 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
2036 if(ErrorString !=
"")
2038 throw Exception(ErrorString +
" for EraseTrackElement 1");
2062 ErasedTrackVectorPosition = VecPos;
2063 TrackEraseSuccessfulFlag =
true;
2069 unsigned int VecPos;
2070 InactiveTrackMapKeyPair.first = HLocInput;
2071 InactiveTrackMapKeyPair.second = VLocInput;
2076 VecPos = InactiveTrack2MultiMapIterator->second;
2081 if(ErrorString !=
"")
2083 throw Exception(ErrorString +
" for EraseTrackElement 2A");
2093 TrackEraseSuccessfulFlag =
true;
2114 VecPos = InactiveTrack2MultiMapIterator->second;
2119 if(ErrorString !=
"")
2121 throw Exception(ErrorString +
" for EraseTrackElement 2B");
2145 if(TrackEraseSuccessfulFlag)
2161 void TTrack::PlotAndAddTrackElement(
int Caller,
int CurrentTag,
int Aspect,
int HLocInput,
int VLocInput,
bool &TrackLinkingRequiredFlag,
bool InternalChecks,
bool PerformNameSearch)
2168 AnsiString(HLocInput) +
"," + AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2169 bool PlatAllowedFlag =
false;
2171 TrackLinkingRequiredFlag =
false;
2183 LocationNameEntry.first =
"";
2191 TempTrackElement.
HLoc = HLocInput;
2192 TempTrackElement.
VLoc = VLocInput;
2218 else if(Aspect == 1)
2222 else if(Aspect == 2)
2226 else if(Aspect == 3)
2235 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
2238 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
2240 if(InactiveFoundFlag)
2244 NonStationOrLevelCrossingPresent =
true;
2248 NonStationOrLevelCrossingPresent =
true;
2252 PlatformPresent =
true;
2263 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
2271 PlatAllowedFlag =
true;
2275 PlatAllowedFlag =
true;
2279 PlatAllowedFlag =
true;
2283 PlatAllowedFlag =
true;
2287 TrackLinkingRequiredFlag =
true;
2289 if(PerformNameSearch)
2318 if((FoundFlag && (
NameAllowed.Contains(
TrackElementAt(1048, VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
2319 (!FoundFlag && !InactiveFoundFlag))
2322 TrackLinkingRequiredFlag =
true;
2324 if(PerformNameSearch)
2357 TrackLinkingRequiredFlag =
true;
2369 else if(FoundFlag || InactiveFoundFlag)
2382 if(PerformNameSearch)
2391 bool BothPointFillets =
true;
2406 TrackLinkingRequiredFlag =
true;
2408 if(InternalChecks && PerformNameSearch)
2420 bool InternalChecks)
2424 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2425 bool PlatAllowedFlag =
false;
2427 TrackLinkingRequiredFlag =
false;
2430 LocationNameEntry.first =
"";
2436 TempTrackElement.
HLoc = HLocInput;
2437 TempTrackElement.
VLoc = VLocInput;
2438 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
2439 for(
int x = 0; x < 4; x++)
2445 TempTrackElement.
Conn[x] = -1;
2459 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
2461 if(InactiveFoundFlag)
2465 NonStationOrLevelCrossingPresent =
true;
2469 NonStationOrLevelCrossingPresent =
true;
2473 PlatformPresent =
true;
2484 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
2492 PlatAllowedFlag =
true;
2496 PlatAllowedFlag =
true;
2500 PlatAllowedFlag =
true;
2504 PlatAllowedFlag =
true;
2508 TrackLinkingRequiredFlag =
true;
2539 if((FoundFlag && (
NameAllowed.Contains(
TrackElementAt(1055, VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
2540 (!FoundFlag && !InactiveFoundFlag))
2543 TrackLinkingRequiredFlag =
true;
2580 TrackLinkingRequiredFlag =
true;
2592 else if(FoundFlag || InactiveFoundFlag)
2611 bool BothPointFillets =
true;
2626 TrackLinkingRequiredFlag =
true;
2656 ShowMessage(
"Gaps must be set before track can be validated");
2666 throw Exception(
"Error, gaps unset when TryToConnectTrack called");
2677 if(!
LinkTrack(1, LocError, HLoc, VLoc,
false))
2694 ShowMessage(
"Error in RepositionAndMapTrack during TryToConnectTrack. Railway file is corrupt, further use may cause a system crash");
2701 if(!
LinkTrack(2, LocError, HLoc, VLoc,
true))
2725 std::pair<AnsiString, char>TempMapPair;
2733 TempMapPair.second =
'x';
2743 AnsiString Name =
"";
2744 typedef std::list<AnsiString> TNoPlatsList;
2745 TNoPlatsList::iterator NPLIt;
2746 TNoPlatsList NoPlatsList;
2747 typedef std::list<AnsiString> TLocNameList;
2748 TLocNameList LocNameList;
2753 LocNameList.push_back(LNMMIt->first);
2756 LocNameList.unique();
2757 for(TLocNameList::iterator LNLIt = LocNameList.begin(); LNLIt != LocNameList.end(); LNLIt++)
2761 if(MMRange.first == MMRange.second)
2767 if((LNMMIt->second) < 0)
2781 TempIt = MMRange.second;
2782 if(LNMMIt == --TempIt)
2784 NoPlatsList.push_back(Name);
2788 if(!NoPlatsList.empty())
2790 AnsiString NoPlatsAnsiList =
"";
2791 for(NPLIt = NoPlatsList.begin(); NPLIt != NoPlatsList.end(); NPLIt++)
2793 NoPlatsAnsiList += *NPLIt +
'\n';
2797 if(NoPlatsList.size() > 1)
2799 ShowMessage(
"Please note: the following locations have no platforms, trains won't be able to stop or pass there:-\n\n" + NoPlatsAnsiList +
"\nThis message will not be shown again.");
2803 ShowMessage(
"Please note: the following location has no platforms, trains won't be able to stop or pass there:-\n\n" + NoPlatsAnsiList +
"\nThis message will not be shown again.");
2818 int NewHLoc, NewVLoc;
2819 bool ConnectionFoundFlag, LinkFoundFlag;
2821 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2823 for(
unsigned int y = 0; y < 4; y++)
2841 ConnectionFoundFlag =
false;
2842 for(
unsigned int z = 0; z <
TrackVector.size(); z++)
2848 ConnectionFoundFlag =
true;
2850 LinkFoundFlag =
false;
2851 for(
unsigned int a = 0; a < 4; a++)
2855 LinkFoundFlag =
true;
2871 if(!ConnectionFoundFlag)
2946 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2963 bool UnsetGaps =
false;
2970 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2974 for(
unsigned int y = 0; y < 4; y++)
2986 for(
unsigned int y = 0; y < 4; y++)
2996 for(
unsigned int y = 1; y < 4; y++)
3005 for(
unsigned int y = 0; y < 4; y++)
3018 for(
unsigned int y = 0; y < 4; y++)
3046 int NumberOfActiveElements = 0;
3048 GraphicsFollow =
false;
3052 if(MarkerString[MarkerString.Length()] ==
'1')
3054 GraphicsFollow =
true;
3056 for(
int x = 0; x < NumberOfActiveElements; x++)
3062 TrackElement.
HLoc = TempInt;
3064 TrackElement.
VLoc = TempInt;
3070 TrackElement.
Conn[0] = TempInt;
3094 if((TempInt != -1) && (TempInt < 10))
3104 if((TempInt != -1) && (TempInt < 10))
3121 if(Marker[1] ==
'3')
3125 else if(Marker[1] ==
'2')
3129 else if(Marker[1] ==
'G')
3143 int NumberOfInactiveElements = 0;
3147 for(
int x = 0; x < NumberOfInactiveElements; x++)
3153 TrackElement.
HLoc = TempInt;
3155 TrackElement.
VLoc = TempInt;
3161 bool LocError =
false;
3190 for(
int x = 0; x < NumberOfGraphics; x++)
3201 bool FileError =
false;
3203 for(
int x = 0; x < NumberOfGraphics; x++)
3216 UGME.second =
new TPicture;
3217 UGME.second->LoadFromFile(
UGME.first);
3220 throw Exception(
"Map Insertion Error 2 - UserGraphicMap insertion failure for " + UGI.
FileName);
3227 catch(
const EInvalidGraphic &e)
3236 delete UGMIt->second;
3241 catch(
const Exception &e)
3250 delete UGMIt->second;
3258 bool FoundInMap =
false;
3277 UGME.second =
new TPicture;
3278 UGME.second->LoadFromFile(
UGME.first);
3281 throw Exception(
"Map Insertion Error 3 - UserGraphicMap insertion failure for " + UGI.
FileName);
3288 catch(
const EInvalidGraphic &e)
3297 delete UGMIt->second;
3302 catch(
const Exception &e)
3311 delete UGMIt->second;
3336 VecFile <<
"**Active elements**1" <<
'\0' <<
'\n';
3340 VecFile <<
"**Active elements**" <<
'\0' <<
'\n';
3342 for(
unsigned int x = 0; x < (
TrackVector.size()); x++)
3345 VecFile << x <<
'\n';
3346 VecFile << TrackElement.
SpeedTag <<
'\n';
3347 VecFile << TrackElement.
HLoc <<
'\n';
3348 VecFile << TrackElement.
VLoc <<
'\n';
3352 VecFile << TrackElement.
Conn[0] <<
'\n';
3356 VecFile << TrackElement.
Attribute <<
'\n';
3362 VecFile << int(1) <<
'\n';
3366 VecFile << int(0) <<
'\n';
3369 VecFile << TrackElement.
Length01 <<
'\n';
3370 VecFile << TrackElement.
Length23 <<
'\n';
3373 VecFile << TrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
3380 VecFile <<
"3*****" <<
'\0' <<
'\n';
3384 VecFile <<
"2*****" <<
'\0' <<
'\n';
3388 VecFile <<
"G*****" <<
'\0' <<
'\n';
3392 VecFile <<
"4*****" <<
'\0' <<
'\n';
3397 VecFile <<
"******" <<
'\0' <<
'\n';
3402 VecFile <<
"**Inactive elements**" <<
'\0' <<
'\n';
3406 VecFile << x <<
'\n';
3407 VecFile << InactiveTrackElement.
SpeedTag <<
'\n';
3408 VecFile << InactiveTrackElement.
HLoc <<
'\n';
3409 VecFile << InactiveTrackElement.
VLoc <<
'\n';
3410 VecFile << InactiveTrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
3411 VecFile <<
"******" <<
'\0' <<
'\n';
3426 GraphicsFollow =
false;
3428 if((NumberOfActiveElements < 0) || (NumberOfActiveElements > 1000000))
3434 AnsiString MarkerString;
3441 if(MarkerString[MarkerString.Length()] ==
'1')
3443 GraphicsFollow =
true;
3445 for(
int x = 0; x < NumberOfActiveElements; x++)
3453 int SpeedTag = TempInt;
3460 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3466 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3471 if((SpeedTag > 87) && (SpeedTag < 96))
3474 if((TempInt < -1) || (TempInt > 3))
3480 if((TempInt < -1) || (TempInt > 999999))
3486 if(((SpeedTag >= 7) && (SpeedTag <= 14)) || ((SpeedTag >= 28) && (SpeedTag <= 43)) || ((SpeedTag >= 132) && (SpeedTag <= 139)) ||
3487 ((SpeedTag >= 68) && (SpeedTag <= 75)))
3490 if((TempInt < -1) || (TempInt > 5))
3496 if((SpeedTag >= 68) && (SpeedTag <= 75))
3499 if((TempInt != 0) && (TempInt != 1))
3506 if((TempInt < -1) || (TempInt > 999999))
3512 if((TempInt < -1) || (TempInt > 999999))
3518 if((TempInt < -1) || (TempInt > 999999))
3524 if((TempInt < -1) || (TempInt > 999999))
3545 int NumberOfInactiveElements = 0;
3548 if(NumberOfInactiveElements < 0)
3558 for(
int x = 0; x < NumberOfInactiveElements; x++)
3572 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3578 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3605 if((NumberOfGraphics < 0) || (NumberOfGraphics > 100000))
3611 AnsiString FileName =
"", TempStr =
"";
3613 for(
int x = 0; x < NumberOfGraphics; x++)
3615 TPicture *TempPicture =
new TPicture;
3624 TempPicture->LoadFromFile(GraphicsPath +
"\\" + FileName);
3637 catch(
const EInvalidGraphic &e)
3642 for(
int y = x + 1; y < NumberOfGraphics; y++)
3648 ShowMessage(FileName +
3649 " has an incorrect file format, user graphics can't be loaded. Ensure that all user graphic files are valid with extension .bmp, .gif, .jpg, or .png");
3654 catch(
const Exception &e)
3659 for(
int y = x + 1; y < NumberOfGraphics; y++)
3665 ShowMessage(
"Unable to load user graphic files, ensure that " + FileName +
3666 " exists in the 'Graphics' folder and that it is has extension .bmp, .gif, .jpg, or .png.");
3684 for(
int x = 0; x < VecSize; x++)
3707 for(
int x = 0; x < VecSize; x++)
3729 for(
int x = 0; x < VecSize; x++)
3783 for(
int x = 0; x < VecSize; x++)
3839 PlotPoints(5, Next, Disp, BothPointFilletsAndBasicLCs);
3891 if(BothPointFilletsAndBasicLCs)
3968 Bitmap->Canvas->CopyMode = cmSrcCopy;
3970 Graphics::TBitmap *GraphicOutput;
4145 for(
int x = 0; x < 40; x++)
4174 Graphics::TBitmap *GraphicPtr;
4189 Graphics::TBitmap* SignalPlatformGraphic;
4222 if(OldTransparentColour !=
clB5G5R5)
4245 Bitmap->Canvas->CopyMode = cmSrcCopy;
4273 Bitmap->Canvas->CopyMode = cmSrcCopy;
4275 Graphics::TBitmap *GraphicOutput;
4285 if(BaseElement == 1)
4381 for(
int x = 0; x < 40; x++)
4410 Graphics::TBitmap *GraphicPtr;
4425 Graphics::TBitmap* SignalPlatformGraphic;
4488 for(
int x = 0; x < 40; x++)
4496 Graphics::TBitmap* SignalPlatformGraphic;
4537 if(OldTransparentColour !=
clB5G5R5)
4551 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4623 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4637 ShowMessage(
"Error - gap connected to a non-gap. Railway file is corrupt, further use may cause a system crash");
4663 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4688 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4718 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4752 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4789 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4807 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4828 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4860 for(TrackMapPtr =
TrackMap.begin(); TrackMapPtr !=
TrackMap.end(); TrackMapPtr++)
4867 throw Exception(
"Error - Map & Vector different sizes");
4869 unsigned int NonZeroCount = 0;
4871 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4880 throw Exception(
"Error - NewVector & NonZero TrackVector different sizes");
4886 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4890 TrackMapEntry.first = TrackMapKeyPair;
4891 TrackMapEntry.second = x;
4892 if(!(
TrackMap.insert(TrackMapEntry).second))
4894 throw Exception(
"Error - map insertion failure, TrackVector in error");
4898 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4900 for(
unsigned int y = 0; y < 4; y++)
4925 THVPair GapMapKeyPair, GapMapValuePair;
4928 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4934 GapMapEntry.first = GapMapKeyPair;
4937 throw Exception(
"Error - Gap connection == -1 Can't build GapMap");
4941 GapMapEntry.second = GapMapValuePair;
4944 GapMap.insert(GapMapEntry);
4959 bool TrackElementPositionsOK =
true;
4961 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4973 "Footbridge or underpass connection error. Each end must connect to a platform, concourse "
4974 "or other footbridge or underpass, and they can't connect to each other (i.e. a footbridge "
4975 "can't connect to an underpass or vice versa)");
4983 for(
unsigned int y = 0; y < 4; y++)
5001 bool ConnectionFoundFlag;
5005 ShowMessage(
"Can't have a track element adjacent to a continuation exit");
5011 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
5020 if(ConnectionFoundFlag)
5025 bool ExitSignal =
false;
5036 ShowMessage(
"Can't have an exit signal next to a level crossing - it can cause the train to foul the crossing in some circumstances");
5038 TrackElementPositionsOK =
false;
5043 ShowMessage(
"Can't have points, crossover or signal next to buffers - need room for a train without fouling");
5045 TrackElementPositionsOK =
false;
5050 ShowMessage(
"Can't have points, crossover, bridge or signal next to a continuation - it can cause route setting problems");
5054 TrackElementPositionsOK =
false;
5059 ShowMessage(
"Can't have two same-direction signals adjacent to each other as there is no room for a train between them");
5062 TrackElementPositionsOK =
false;
5074 ShowMessage(
"Bridge next to a signal - routes can't be truncated to this or other such signals.\n\nThis restriction can be removed or reinstated by pressing\nCTRL ALT 5. When removed this message will not be shown again.");
5077 TrackElementPositionsOK =
false;
5082 ShowMessage(
"Can't have two level crossings adjacent to each other on the same track");
5083 TrackElementPositionsOK =
false;
5086 if(!TrackElementPositionsOK)
5093 throw Exception(
"Error in track element positions in FinalCall");
5106 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5112 for(
unsigned int y = 0; y < 4; y++)
5134 bool ConnectionFoundFlag;
5135 bool LinkMatchFound =
false;
5138 if(ConnectionFoundFlag)
5140 for(
unsigned int a = 0; a < 4; a++)
5146 LinkMatchFound =
true;
5157 throw Exception(
"Error in final track linkage - - no matching link found");
5170 throw Exception(
"Error in final track linkage - connection not found");
5186 bool ConnErrorFlag =
false;
5188 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5192 ConnErrorFlag =
true;
5196 ConnErrorFlag =
true;
5200 ConnErrorFlag =
true;
5204 ConnErrorFlag =
true;
5213 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
5222 throw Exception(
"ConnError in LinkTrack - Final");
5226 throw Exception(
"ConnError in LinkTrack - Precheck");
5229 bool CLkErrorFlag =
false;
5231 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5235 CLkErrorFlag =
true;
5239 CLkErrorFlag =
true;
5243 CLkErrorFlag =
true;
5247 CLkErrorFlag =
true;
5255 throw Exception(
"CLkError in LinkTrack - Final");
5259 throw Exception(
"CLkError in LinkTrack - Precheck");
5264 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5294 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5310 for(
unsigned int y = 0; y < 4; y++)
5329 bool ConnectionFoundFlag;
5335 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
5344 if(ConnectionFoundFlag)
5347 bool LinkFoundFlag =
false;
5404 for(
unsigned int a = 0; a < 4; a++)
5413 LinkFoundFlag =
true;
5421 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - invalid link");
5431 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - connection not found");
5445 bool ConnErrorFlag =
false;
5447 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5451 ConnErrorFlag =
true;
5455 ConnErrorFlag =
true;
5459 ConnErrorFlag =
true;
5463 ConnErrorFlag =
true;
5472 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
5481 throw Exception(
"ConnError in LinkTrack - Final");
5485 throw Exception(
"ConnError in LinkTrack - Precheck");
5488 bool CLkErrorFlag =
false;
5490 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5494 CLkErrorFlag =
true;
5498 CLkErrorFlag =
true;
5502 CLkErrorFlag =
true;
5506 CLkErrorFlag =
true;
5514 throw Exception(
"CLkError in LinkTrack - Final");
5518 throw Exception(
"CLkError in LinkTrack - Precheck");
5522 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5551 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5567 for(
unsigned int y = 0; y < 4; y++)
5586 bool ConnectionFoundFlag =
false;
5588 if(ConnectionFoundFlag)
5592 bool LinkFoundFlag =
false;
5612 for(
unsigned int a = 0; a < 4; a++)
5621 LinkFoundFlag =
true;
5641 bool ConnErrorFlag =
false;
5643 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5647 ConnErrorFlag =
true;
5651 ConnErrorFlag =
true;
5655 ConnErrorFlag =
true;
5659 ConnErrorFlag =
true;
5667 bool CLkErrorFlag =
false;
5669 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5673 CLkErrorFlag =
true;
5677 CLkErrorFlag =
true;
5681 CLkErrorFlag =
true;
5685 CLkErrorFlag =
true;
5703 int Position1, Position2;
5709 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
5711 int HLoc1 = GapMapPtr->first.first;
5712 int VLoc1 = GapMapPtr->first.second;
5713 int HLoc2 = GapMapPtr->second.first;
5714 int VLoc2 = GapMapPtr->second.second;
5717 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
5721 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
5725 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
5729 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
5747 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
5748 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
5758 bool FoundFlag =
false;
5770 InactiveTrackMapKeyPair.first = TrackElement.
HLoc;
5771 InactiveTrackMapKeyPair.second = TrackElement.
VLoc;
5772 InactiveTrackMapEntry.first = InactiveTrackMapKeyPair;
5801 bool FoundFlag =
false;
5814 TrackMapKeyPair.first = TrackElement.
HLoc;
5815 TrackMapKeyPair.second = TrackElement.
VLoc;
5816 TrackMapEntry.first = TrackMapKeyPair;
5821 LocationNameEntry.second = -(int)(
TrackVector.size());
5861 TrackMapKeyPair.first = HLoc;
5862 TrackMapKeyPair.second = VLoc;
5863 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5873 return(TrackMapPtr->second);
5886 TrackMapKeyPair.first = HLoc;
5887 TrackMapKeyPair.second = VLoc;
5888 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5891 AnsiString Message =
"Element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5892 throw Exception(Message);
5910 MapKeyPair.first = HLoc;
5911 MapKeyPair.second = VLoc;
5912 MapPtr = Map.find(MapKeyPair);
5913 if(MapPtr == Map.end())
5915 AnsiString Message =
"Element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc) +
" in GetTrackElementFromAnyTrackMap";
5916 throw Exception(Message);
5921 return(Vector.at(MapPtr->second));
5931 THVPair InactiveTrackMapKeyPair;
5934 InactiveTrackMapKeyPair.first = HLoc;
5935 InactiveTrackMapKeyPair.second = VLoc;
5939 AnsiString Message =
"Inactive element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5940 throw Exception(Message);
5954 bool Present =
true;
5958 TrackMapKeyPair.first = HLoc;
5959 TrackMapKeyPair.second = VLoc;
5960 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5975 bool Present =
true;
5976 THVPair InactiveTrackMapKeyPair;
5979 InactiveTrackMapKeyPair.first = HLoc;
5980 InactiveTrackMapKeyPair.second = VLoc;
5998 THVPair InactiveTrackMapKeyPair;
6003 InactiveTrackMapKeyPair.first = HLoc;
6004 InactiveTrackMapKeyPair.second = VLoc;
6013 if(InactiveTrackRange.first == InactiveTrackRange.second)
6022 RetPair.first = InactiveTrackRange.first->second;
6023 RetPair.second = (--InactiveTrackRange.second)->second;
6036 AnsiString(DivergingPosition));
6047 if(((SpeedTag1 == 7) && (SpeedTag2 == 10)) ||
6048 ((SpeedTag1 == 10) && (SpeedTag2 == 7)) || ((SpeedTag1 == 8) && (SpeedTag2 == 9)) || ((SpeedTag1 == 9) && (SpeedTag2 == 8)) ||
6049 ((SpeedTag1 == 11) && (SpeedTag2 == 14)) ||
6050 ((SpeedTag1 == 14) && (SpeedTag2 == 11)) || ((SpeedTag1 == 12) && (SpeedTag2 == 13)) || ((SpeedTag1 == 13) && (SpeedTag2 == 12)) ||
6051 ((SpeedTag1 == 28) && (SpeedTag2 == 31)) ||
6052 ((SpeedTag1 == 31) && (SpeedTag2 == 28)) || ((SpeedTag1 == 29) && (SpeedTag2 == 30)) || ((SpeedTag1 == 30) && (SpeedTag2 == 29)) ||
6053 ((SpeedTag1 == 32) && (SpeedTag2 == 35)) ||
6054 ((SpeedTag1 == 35) && (SpeedTag2 == 32)) || ((SpeedTag1 == 33) && (SpeedTag2 == 34)) || ((SpeedTag1 == 34) && (SpeedTag2 == 33)) ||
6055 ((SpeedTag1 == 36) && (SpeedTag2 == 39)) ||
6056 ((SpeedTag1 == 39) && (SpeedTag2 == 36)) || ((SpeedTag1 == 37) && (SpeedTag2 == 38)) || ((SpeedTag1 == 38) && (SpeedTag2 == 37)) ||
6057 ((SpeedTag1 == 40) && (SpeedTag2 == 43)) ||
6058 ((SpeedTag1 == 43) && (SpeedTag2 == 40)) || ((SpeedTag1 == 41) && (SpeedTag2 == 42)) || ((SpeedTag1 == 42) && (SpeedTag2 == 41)))
6092 throw Exception(
"Error, Wrong track type in PlotGap");
6094 if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] > -1))
6098 else if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] == -1))
6102 if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] > -1))
6106 else if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] == -1))
6110 if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] > -1))
6114 else if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] == -1))
6118 if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] > -1))
6122 else if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] == -1))
6126 if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] > -1))
6130 else if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] == -1))
6134 if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] > -1))
6138 else if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] == -1))
6142 if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] > -1))
6146 else if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] == -1))
6150 if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] > -1))
6154 else if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] == -1))
6170 PosPair.first = TrackElement.
HLoc;
6171 PosPair.second = TrackElement.
VLoc;
6175 Disp->
PlotOutput(283, TrackElement.
HLoc * 16, TrackElement.
VLoc * 16, MOMIt->second);
6188 throw Exception(
"Error, Wrong track type in PlotPoints");
6192 bool FoundFlag =
false;
6194 if(IMPair.first > 0)
6210 else if(TrackElement.
SpeedTag < 132)
6221 else if(!TrackElement.
Failed)
6228 else if(TrackElement.
SpeedTag < 132)
6246 else if(TrackElement.
SpeedTag < 132)
6260 bool BlueLoc =
false;
6269 if(FoundFlag && !BlueLoc)
6284 bool FoundFlag =
false;
6287 throw Exception(
"Error, Wrong track type in PlotSignal");
6291 for(
int x = 0; x < 40; x++)
6307 if(IMPair.first > 0)
6374 for(
int x = 0; x < 40; x++)
6381 Graphics::TBitmap* SignalPlatformGraphic;
6383 if(IMPair.first > 0)
6405 for(
int x = 0; x < 8; x++)
6412 if(IMPair.first > 0)
6429 for(
int x = 0; x < 8; x++)
6436 if(IMPair.first > 0)
6529 while(
IsLCAtHV(0, HLoc, (VLoc + UpStep)))
6537 while(
IsLCAtHV(1, HLoc, (VLoc + DownStep)))
6545 while(
IsLCAtHV(2, (HLoc + LeftStep), VLoc))
6553 while(
IsLCAtHV(3, (HLoc + RightStep), VLoc))
6569 while(
IsLCAtHV(51, HLoc, (VLoc + UpStep)))
6577 while(
IsLCAtHV(52, HLoc, (VLoc + DownStep)))
6585 while(
IsLCAtHV(53, (HLoc + LeftStep), VLoc))
6593 while(
IsLCAtHV(54, (HLoc + RightStep), VLoc))
6626 while(
IsLCAtHV(55, HLoc, (VLoc + UpStep)))
6638 while(
IsLCAtHV(56, HLoc, (VLoc + DownStep)))
6650 while(
IsLCAtHV(57, (HLoc + LeftStep), VLoc))
6662 while(
IsLCAtHV(58, (HLoc + RightStep), VLoc))
6704 throw Exception(
"Error, Wrong track type in PlotAndLowerLevelCrossingBarriers");
6706 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6708 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndLowerLevelCrossingBarriers");
6711 if(BaseElementSpeedTag == 1)
6715 while(
IsLCAtHV(5, HLoc, (VLoc + UpStep)))
6722 while(
IsLCAtHV(6, HLoc, (VLoc + DownStep)))
6730 Graphics::TBitmap *RouteGraphic;
6732 if(TypeOfRoute == 1)
6736 else if(TypeOfRoute == 0)
6742 RouteGraphic = BaseGraphic;
6749 if(UpStep == DownStep)
6752 Disp->
PlotOutput(133, HLoc * 16, VLoc * 16, RouteGraphic);
6762 else if((DownStep - UpStep) == 1)
6767 Disp->
PlotOutput(136, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6777 Disp->
PlotOutput(139, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6790 Disp->
PlotOutput(196, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6800 Disp->
PlotOutput(199, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
6816 Disp->
PlotOutput(142, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6826 Disp->
PlotOutput(145, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6836 else if(DownStep == 0)
6839 Disp->
PlotOutput(202, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6849 Disp->
PlotOutput(205, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
6862 Disp->
PlotOutput(208, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6872 Disp->
PlotOutput(211, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6882 for(
int x = (UpStep + 1); x < DownStep; x++)
6887 Disp->
PlotOutput(148, HLoc * 16, (VLoc + x) * 16, RouteGraphic);
6891 Disp->
PlotOutput(213, HLoc * 16, (VLoc + x) * 16, BaseGraphic);
6912 while(
IsLCAtHV(7, (HLoc + LStep), VLoc))
6919 while(
IsLCAtHV(8, (HLoc + RStep), VLoc))
6925 Graphics::TBitmap *RouteGraphic;
6927 if(TypeOfRoute == 1)
6931 else if(TypeOfRoute == 0)
6937 RouteGraphic = BaseGraphic;
6946 Disp->
PlotOutput(151, HLoc * 16, VLoc * 16, RouteGraphic);
6956 else if((RStep - LStep) == 1)
6961 Disp->
PlotOutput(154, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
6971 Disp->
PlotOutput(157, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6984 Disp->
PlotOutput(215, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6994 Disp->
PlotOutput(218, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
7010 Disp->
PlotOutput(160, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
7020 Disp->
PlotOutput(163, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
7033 Disp->
PlotOutput(221, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
7043 Disp->
PlotOutput(224, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
7056 Disp->
PlotOutput(227, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
7066 Disp->
PlotOutput(230, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
7076 for(
int x = (LStep + 1); x < RStep; x++)
7081 Disp->
PlotOutput(166, (HLoc + x) * 16, VLoc * 16, RouteGraphic);
7085 Disp->
PlotOutput(232, (HLoc + x) * 16, VLoc * 16, BaseGraphic);
7109 AnsiString(HLoc) +
"," + AnsiString(VLoc));
7112 throw Exception(
"Error, Wrong track type in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
7114 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
7116 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
7119 if(BaseElementSpeedTag == 1)
7123 while(
IsLCAtHV(30, HLoc, (VLoc + UpStep)))
7130 while(
IsLCAtHV(31, HLoc, (VLoc + DownStep)))
7136 if(UpStep == DownStep)
7147 else if((DownStep - UpStep) == 1)
7166 for(
int x = (UpStep + 1); x < DownStep; x++)
7175 for(
int x = (UpStep + 1); x < DownStep; x++)
7182 for(
int x = UpStep; x <= DownStep; x++)
7195 while(
IsLCAtHV(32, (HLoc + LStep), VLoc))
7202 while(
IsLCAtHV(33, (HLoc + RStep), VLoc))
7219 else if((RStep - LStep) == 1)
7238 for(
int x = (LStep + 1); x < RStep; x++)
7247 for(
int x = (LStep + 1); x < RStep; x++)
7254 for(
int x = LStep; x <= RStep; x++)
7273 throw Exception(
"Error, Wrong track type in PlotAndRaiseLevelCrossingBarriers");
7275 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
7277 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndRaiseLevelCrossingBarriers");
7280 if(BaseElementSpeedTag == 1)
7284 while(
IsLCAtHV(10, HLoc, (VLoc + UpStep)))
7291 while(
IsLCAtHV(11, HLoc, (VLoc + DownStep)))
7297 for(
int x = UpStep; x < (DownStep + 1); x++)
7312 while(
IsLCAtHV(12, (HLoc + LStep), VLoc))
7319 while(
IsLCAtHV(13, (HLoc + RStep), VLoc))
7325 for(
int x = LStep; x < (RStep + 1); x++)
7344 AnsiString(HLoc) +
"," + AnsiString(VLoc));
7347 throw Exception(
"Error, Wrong track type in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
7349 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
7351 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
7356 if(BaseElementSpeedTag == 1)
7360 while(
IsLCAtHV(35, HLoc, (VLoc + UpStep)))
7367 while(
IsLCAtHV(36, HLoc, (VLoc + DownStep)))
7373 for(
int x = UpStep; x <= DownStep; x++)
7387 while(
IsLCAtHV(37, (HLoc + LStep), VLoc))
7394 while(
IsLCAtHV(38, (HLoc + RStep), VLoc))
7400 for(
int x = LStep; x <= RStep; x++)
7416 Graphics::TBitmap *RouteGraphic;
7419 if(BaseElementSpeedTag == 1)
7421 if(TypeOfRoute == 1)
7425 else if(TypeOfRoute == 0)
7431 RouteGraphic = BaseGraphic;
7435 RouteGraphic = BaseGraphic;
7441 if(TypeOfRoute == 1)
7445 else if(TypeOfRoute == 0)
7451 RouteGraphic = BaseGraphic;
7455 RouteGraphic = BaseGraphic;
7460 while(
IsLCAtHV(14, HLoc, (VLoc + UpStep)))
7465 Disp->
PlotOutput(175, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
7469 Disp->
PlotOutput(234, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
7476 while(
IsLCAtHV(15, HLoc, (VLoc + DownStep)))
7479 Disp->
PlotOutput(177, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
7484 while(
IsLCAtHV(16, (HLoc + LeftStep), VLoc))
7489 Disp->
PlotOutput(235, (HLoc + LeftStep) * 16, VLoc * 16, RouteGraphic);
7493 Disp->
PlotOutput(236, (HLoc + LeftStep) * 16, VLoc * 16, BaseGraphic);
7500 while(
IsLCAtHV(17, (HLoc + RightStep), VLoc))
7503 Disp->
PlotOutput(238, (HLoc + RightStep) * 16, VLoc * 16, BaseGraphic);
7628 throw Exception(
"Element not found in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
7632 throw Exception(
"Element not a level crossing in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
7663 "," + AnsiString(VLoc));
7667 int DummyRouteNumber;
7669 TrainPresent =
false;
7673 while(
IsLCAtHV(25, HLoc, (VLoc + UpStep)))
7675 TrackMapKeyPair.first = HLoc;
7676 TrackMapKeyPair.second = VLoc + UpStep;
7677 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7686 TrainPresent =
true;
7700 while(
IsLCAtHV(26, HLoc, (VLoc + DownStep)))
7702 TrackMapKeyPair.first = HLoc;
7703 TrackMapKeyPair.second = VLoc + DownStep;
7704 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7713 TrainPresent =
true;
7727 while(
IsLCAtHV(27, (HLoc + LeftStep), VLoc))
7729 TrackMapKeyPair.first = HLoc + LeftStep;
7730 TrackMapKeyPair.second = VLoc;
7731 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7740 TrainPresent =
true;
7754 while(
IsLCAtHV(28, (HLoc + RightStep), VLoc))
7756 TrackMapKeyPair.first = HLoc + RightStep;
7757 TrackMapKeyPair.second = VLoc;
7758 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7767 TrainPresent =
true;
7787 for(
unsigned int x = 0; x < SearchVector.size(); x++)
7804 AnsiString(HLoc) +
"," + AnsiString(VLoc));
7807 throw Exception(
"PlotSmallFlashingLinkedLevelCrossings");
7813 while(
IsLCAtHV(61, HLoc, (VLoc + UpStep)))
7820 while(
IsLCAtHV(62, HLoc, (VLoc + DownStep)))
7826 for(
int x = UpStep; x <= DownStep; x++)
7833 while(
IsLCAtHV(63, (HLoc + LStep), VLoc))
7840 while(
IsLCAtHV(64, (HLoc + RStep), VLoc))
7846 for(
int x = LStep; x <= RStep; x++)
7862 throw Exception(
"Error, Wrong track type in GetFilletGraphic");
7869 else if(TrackElement.
SpeedTag < 132)
7887 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
7904 AnsiString(ScreenPosV));
7919 AnsiString(ScreenPosV));
7930 AnsiString(VPosTrue));
7944 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
7956 throw Exception(
"CheckMapAndTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
7957 " in TrackMap, Caller=" + (AnsiString)Caller);
7959 if(MapVecPos != (
int)a)
7961 throw Exception(
"CheckMapAndTrack Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
7962 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)MapVecPos +
" TrackVectorPos value=" + (AnsiString)a +
" Caller=" +
7963 (AnsiString)Caller);
7969 throw Exception(
"CheckMapAndTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
7970 " Caller=" + (AnsiString)Caller);
7990 throw Exception(
"CheckMapAndInactiveTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
7991 " in InactiveMap, Caller=" + (AnsiString)Caller);
7993 if((InactivePair.first != a) && (InactivePair.second != a))
7995 throw Exception(
"CheckMapAndInactiveTrack Error - InactiveMapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
7996 (AnsiString)CheckElement.
VLoc +
" Inactive Map values=" + (AnsiString)InactivePair.first +
" and " + (AnsiString)InactivePair.second +
7997 " InactiveTrackVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
8002 throw Exception(
"CheckMapAndInactiveTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
8003 " Caller=" + (AnsiString)Caller);
8013 int Position1, Position2;
8019 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
8021 int HLoc1 = GapMapPtr->first.first;
8022 int VLoc1 = GapMapPtr->first.second;
8023 int HLoc2 = GapMapPtr->second.first;
8024 int VLoc2 = GapMapPtr->second.second;
8027 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
8031 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
8035 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
8039 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
8043 unsigned int GapCount = 0;
8045 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
8053 if((
GapMap.size() * 2) != GapCount)
8055 throw Exception(
"GapMap Error - Map Size * 2 =" + (AnsiString)(
GapMap.size() * 2) +
" GapCount=" + (AnsiString)GapCount +
" Caller=" +
8056 (AnsiString)Caller);
8066 if((TrackElement.
HLoc == -2000000000) || (TrackElement.
VLoc == -2000000000))
8070 throw Exception(
"Error - TrackFinished with erase element still present");
8075 AnsiString IDString;
8077 if(TrackElement.
HLoc < 0)
8079 IDString =
"N" + AnsiString(abs(TrackElement.
HLoc)) +
"-";
8083 IDString = AnsiString(TrackElement.
HLoc) +
"-";
8085 if(TrackElement.
VLoc < 0)
8087 IDString +=
"N" + AnsiString(abs(TrackElement.
VLoc));
8091 IDString += AnsiString(TrackElement.
VLoc);
8106 for(
int x = 1; x < String.Length() + 1; x++)
8108 if(String.IsDelimiter(
"-", x))
8113 if(x == String.Length())
8117 ShowMessage(
"Error in track element identifier: <" + String +
"> - no delimiter");
8127 ShowMessage(
"Error in track element identifier: <" + String +
"> - No Horizontal value");
8132 if(DelimPos == String.Length())
8136 ShowMessage(
"Error in track element identifier <" + String +
"> - No Vertical value");
8141 if((String[String.Length()] <
'0') || (String[String.Length()] >
'9'))
8145 ShowMessage(
"Error in track element identifier <" + String +
"> - Last value is not a number");
8152 if(String.SubString(1, 1) !=
"N")
8154 for(
int x = 1; x < DelimPos; x++)
8156 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
8160 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
8167 if(String.SubString(1, 1) ==
"N")
8169 for(
int x = 2; x < DelimPos; x++)
8171 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
8175 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
8182 if(String.SubString(1, 1) ==
"N")
8184 HLoc = -(String.SubString(2, DelimPos - 2).ToInt());
8188 HLoc = String.SubString(1, DelimPos - 1).ToInt();
8190 if(String.SubString(DelimPos + 1, 1) !=
"N")
8192 for(
int x = DelimPos + 1; x < String.Length() + 1; x++)
8194 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
8198 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
8205 if(String.SubString(DelimPos + 1, 1) ==
"N")
8207 for(
int x = DelimPos + 2; x < String.Length() + 1; x++)
8209 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
8213 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
8220 if(String.SubString(DelimPos + 1, 1) ==
"N")
8222 VLoc = -(String.SubString(DelimPos + 2, String.Length() - DelimPos - 1).ToInt());
8226 VLoc = String.SubString(DelimPos + 1, String.Length() - DelimPos).ToInt();
8231 TrackMapPtr =
TrackMap.find(HVPair);
8236 ShowMessage(
"No track element corresponding to track element identifier: <" + String +
">");
8242 return(TrackMapPtr->second);
8244 catch(
const Exception &e)
8247 ShowMessage(
"Syntax error in track element identifier: <" + String +
">");
8261 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
8262 int HLoc = TrackElement.
HLoc;
8263 int VLoc = TrackElement.
VLoc;
8366 AnsiString(SpeedTag));
8377 if(HVRange.first == HVRange.second)
8384 HVIt1 = HVRange.first;
8389 if(--HVRange.second != HVRange.first)
8391 HVIt2 = HVRange.second;
8395 HVIt2->second).
SpeedTag == SpeedTag)))
8415 AnsiString(SpeedTag));
8481 AnsiString TestString1, TestString2;
8486 throw Exception(
"LNPendingList size not 1 on entry");
8488 int CurrentElementNumber;
8489 bool FoundFlag =
false, ErasedFlag =
false;
8495 int H = CurrentElement->HLoc;
8496 int V = CurrentElement->VLoc;
8497 int Tag = CurrentElement->SpeedTag;
8503 for(
int x = 0; x < 25; x++)
8513 for(
int x = 0; x < 25; x++)
8523 for(
int x = 0; x < 25; x++)
8533 for(
int x = 0; x < 25; x++)
8543 for(
int x = 0; x < 28; x++)
8553 for(
int x = 0; x < 8; x++)
8563 for(
int x = 0; x < 8; x++)
8573 for(
int x = 0; x < 4; x++)
8589 bool FoundFlag2 =
false;
8607 for(
int x = 0; x < 8; x++)
8617 for(
int x = 0; x < 8; x++)
8630 if(CurrentElementNumber > -1)
8635 if((ExistingName !=
"") && (ExistingName != LocationName))
8651 AddName(1, CurrentElement, LocationName);
8655 LNDone2MultiMapEntry.first = HVPair;
8667 if(SNRange.first != SNRange.second)
8671 for(SNIterator = SNRange.second; SNIterator != SNRange.first; SNIterator--)
8678 TVIt->LocationName =
"";
8679 TVIt->ActiveTrackElementName =
"";
8713 std::pair<AnsiString, char>TempMapPair;
8721 TempMapPair.second =
'x';
8739 AnsiString(SpeedTag));
8749 if((SpeedTag == 129) || (SpeedTag == 130) || (SpeedTag == 145) || (SpeedTag == 146))
8756 int MapPos = -1 - Position;
8760 FoundElement = MapPos;
8776 FoundElement = IMPair.first;
8785 FoundElement = IMPair.second;
8806 AnsiString OldName = TrackElement->LocationName, ErrorString;
8808 TrackElement->LocationName = Name;
8809 int HLoc = TrackElement->HLoc;
8810 int VLoc = TrackElement->VLoc;
8824 if(ErrorString !=
"")
8826 throw Exception(ErrorString +
" in AddName for OldName == " + OldName);
8850 if(LNDone2MultiMapIterator->second == MapPos)
8877 if(*LNPendingListIterator == MapPos)
8950 if(NameBeingChecked !=
"")
8956 ShowMessage(
"Please note that more than one instance of " + NameBeingChecked +
" was found. Location names must be unique before the railway can be saved as a .rly file");
8964 NameBeingChecked = LNMMRg.second->first;
8966 if(NameBeingChecked !=
"")
8972 ShowMessage(
"Please note that more than one instance of " + NameBeingChecked +
" was found. Location names must be unique before the railway can be saved as a .rly file");
8993 if(LNMMIt->second < 0)
9003 HVPairsLinkedMap.insert(std::pair<THVPair, bool>(HVPair,
false));
9011 std::list<THVPair> HVLinkedList;
9014 HVPairsLinkedMap.begin()->second =
true;
9015 HVLinkedList.push_back(HVPairsLinkedMap.begin()->first);
9018 THVPair HVPairUnderExamination;
9019 THVPairsLinkedMap::iterator HVPLMIt;
9021 while(!HVLinkedList.empty())
9023 HVPairUnderExamination = HVLinkedList.front();
9024 HVLinkedList.pop_front();
9025 HVPairNew.first = HVPairUnderExamination.first;
9026 HVPairNew.second = HVPairUnderExamination.second - 1;
9027 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
9028 if(HVPLMIt != HVPairsLinkedMap.end())
9030 if(!HVPLMIt->second)
9032 HVLinkedList.push_back(HVPLMIt->first);
9034 HVPLMIt->second =
true;
9036 HVPairNew.first = HVPairUnderExamination.first - 1;
9037 HVPairNew.second = HVPairUnderExamination.second;
9038 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
9039 if(HVPLMIt != HVPairsLinkedMap.end())
9041 if(!HVPLMIt->second)
9043 HVLinkedList.push_back(HVPLMIt->first);
9045 HVPLMIt->second =
true;
9047 HVPairNew.first = HVPairUnderExamination.first;
9048 HVPairNew.second = HVPairUnderExamination.second + 1;
9049 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
9050 if(HVPLMIt != HVPairsLinkedMap.end())
9052 if(!HVPLMIt->second)
9054 HVLinkedList.push_back(HVPLMIt->first);
9056 HVPLMIt->second =
true;
9058 HVPairNew.first = HVPairUnderExamination.first + 1;
9059 HVPairNew.second = HVPairUnderExamination.second;
9060 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
9061 if(HVPLMIt != HVPairsLinkedMap.end())
9063 if(!HVPLMIt->second)
9065 HVLinkedList.push_back(HVPLMIt->first);
9067 HVPLMIt->second =
true;
9072 for(THVPairsLinkedMap::iterator HVPLMIt = HVPairsLinkedMap.begin(); HVPLMIt != HVPairsLinkedMap.end(); HVPLMIt++)
9074 if(!HVPLMIt->second)
9093 if(LocationName ==
"")
9104 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9111 ActiveTrackElementNameMapEntry.second = 0;
9133 bool FoundFlag, ErasedFlag =
false;
9137 if(SNRange.first != SNRange.second)
9140 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
9143 TVIt->LocationName =
"";
9144 TVIt->ActiveTrackElementName =
"";
9178 AnsiString(VLoc) +
"," + AnsiString(SpeedTag));
9180 AnsiString LocationName;
9189 if(LocationName !=
"")
9197 if(LocationName !=
"")
9211 if(LocationName !=
"")
9213 int ModifiedPosition = -1 - Position;
9222 for(
int x = 0; x < 25; x++)
9232 else if(SpeedTag == 77)
9234 for(
int x = 0; x < 25; x++)
9244 else if(SpeedTag == 78)
9246 for(
int x = 0; x < 25; x++)
9256 else if(SpeedTag == 79)
9258 for(
int x = 0; x < 25; x++)
9268 else if(SpeedTag == 96)
9270 for(
int x = 0; x < 28; x++)
9280 else if(SpeedTag == 129)
9282 for(
int x = 0; x < 8; x++)
9292 else if(SpeedTag == 130)
9294 for(
int x = 0; x < 8; x++)
9304 else if(SpeedTag == 145)
9306 for(
int x = 0; x < 8; x++)
9316 else if(SpeedTag == 146)
9318 for(
int x = 0; x < 8; x++)
9328 else if(SpeedTag == 131)
9330 for(
int x = 0; x < 4; x++)
9350 bool FoundFlag2 =
false;
9377 AnsiString(SpeedTag));
9389 if(TempElement->LocationName !=
"")
9391 LocationName = TempElement->LocationName;
9392 FoundElement = IMPair.first;
9400 if(TempElement->LocationName !=
"")
9402 LocationName = TempElement->LocationName;
9403 FoundElement = IMPair.second;
9415 if(TempElement->LocationName !=
"")
9417 LocationName = TempElement->LocationName;
9418 FoundElement = -1 - Position;
9434 unsigned int Count = 0;
9441 AnsiString SName, TName, ErrorString;
9443 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9449 throw Exception(
"Track element has FixedNamedLocationElement set but is not a footbridge/underpass in CheckLocationNameMultiMap, caller = " +
9450 AnsiString(Caller));
9463 (
"Inactive track element has FixedNamedLocationElement set but is not a platform, concourse or named location in CheckLocationNameMultiMap, caller = " +
9464 AnsiString(Caller));
9471 throw Exception(
"LocationNameMultiMap size = " + AnsiString(
LocationNameMultiMap.size()) +
" & Count = " + AnsiString(Count) +
9472 " in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9477 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9483 if(ErrorString !=
"")
9485 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for TrackVector check, caller = " + AnsiString(Caller));
9487 if(SNIt->second != -1 - (
int)x)
9489 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
9490 AnsiString(Caller));
9496 bool FoundFlag =
false;
9505 throw Exception(
"Track element with ActiveTrackElementName but no plat/named loc at H " + AnsiString(
TrackElementAt(1369, x).HLoc) +
" & V " +
9506 AnsiString(
TrackElementAt(1370, x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9510 throw Exception(
"Track element with ActiveTrackElementName " + TName +
" but plat/named loc at H " + AnsiString(
TrackElementAt(1371, x).HLoc) +
9511 " & V " + AnsiString(
TrackElementAt(1372, x).VLoc) +
" has different LocationName in CheckLocationNameMultiMap, caller = " +
9512 AnsiString(Caller));
9517 throw Exception(
"Track element with ActiveTrackElementName but no inactive element at H " + AnsiString(
TrackElementAt(1373, x).HLoc) +
" & V " +
9518 AnsiString(
TrackElementAt(1374, x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9528 if(ErrorString !=
"")
9530 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for InactiveTrackVector check, caller = " + AnsiString(Caller));
9532 if(SNIt->second != (
int)x)
9534 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
9535 AnsiString(Caller));
9545 AnsiString &ErrorString)
9553 AnsiString(TrackElement->HLoc) +
"," + AnsiString(TrackElement->VLoc) +
"," + AnsiString(TrackElement->SpeedTag));
9555 bool FoundFlag =
false;
9559 if(SNRange.first == SNRange.second)
9561 ErrorString =
"Error, Name " + LocationName +
" not found in map";
9563 return(SNRange.first);
9567 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
9569 if(SNIterator->second < 0)
9571 int TVPos = -1 - SNIterator->second;
9573 if(TVIt == TrackElement)
9582 int ITVPos = SNIterator->second;
9584 if(ITVIt == TrackElement)
9595 ErrorString =
"Error, Name " + LocationName +
" found but not at required element";
9612 LocationNameEntry.first = NewName;
9613 LocationNameEntry.second = SNIterator->second;
9627 int TruePos = -1 - Position;
9631 throw Exception(
"Footbridge/underpass error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
9641 throw Exception(
"Inactive element error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
9664 InactiveTrack2MultiMapIterator++)
9666 if(InactiveTrack2MultiMapIterator->second > VecPos)
9668 InactiveTrack2MultiMapIterator->second--;
9676 LocationNameMultiMapIterator++)
9678 if(LocationNameMultiMapIterator->second < 0)
9682 if(LocationNameMultiMapIterator->second > (
int)VecPos)
9684 LocationNameMultiMapIterator->second--;
9706 for(TrackMapIterator =
TrackMap.begin(); TrackMapIterator !=
TrackMap.end(); TrackMapIterator++)
9708 if(TrackMapIterator->second > VecPos)
9710 TrackMapIterator->second--;
9718 LocationNameMultiMapIterator++)
9720 if(LocationNameMultiMapIterator->second >= 0)
9726 if(LocationNameMultiMapIterator->second < -(
int)(VecPos + 1))
9728 LocationNameMultiMapIterator->second++;
9732 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9738 if(TkEl.
Conn[0] ==
int(VecPos))
9743 if(TkEl.
Conn[0] >
int(VecPos))
9747 if(TkEl.
Conn[0] > -1)
9775 for(
unsigned int TVPos = 0; TVPos <
TrackVector.size(); TVPos++)
9781 LocationNameEntry.second = -1 - TVPos;
9792 LocationNameEntry.second = ITVPos;
9834 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9866 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9887 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9913 AnsiString((
short)FirstTrack));
9915 int EXArray[16][2] =
9917 {2, 4}, {6, 2}, {8, 6}, {4, 8},
9918 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
9921 int Index = -1, BrNum = -1, GrNum = -1, InLink, OutLink;
9922 Graphics::TBitmap *Bitmap;
9928 InLink = TrackElement.
Link[0];
9929 OutLink = TrackElement.
Link[1];
9935 InLink = TrackElement.
Link[2];
9936 OutLink = TrackElement.
Link[3];
9940 for(
int x = 0; x < 16; x++)
9942 if((InLink == EXArray[x][0] && OutLink == EXArray[x][1]) || (InLink == EXArray[x][1] && OutLink == EXArray[x][0]))
9949 throw Exception(
"Error, failed to find Index in TTrack::MarkOneLengthandSpeed");
9970 else if(TrackElement.
SpeedTag == 54)
9974 else if(TrackElement.
SpeedTag == 55)
9985 else if(TrackElement.
SpeedTag == 58)
9989 else if(TrackElement.
SpeedTag == 59)
9994 else if(Index == 14)
10000 else if(TrackElement.
SpeedTag == 52)
10004 else if(TrackElement.
SpeedTag == 57)
10009 else if(Index == 15)
10015 else if(TrackElement.
SpeedTag == 53)
10019 else if(TrackElement.
SpeedTag == 56)
10101 TRect Rect(0,0,16,16);
10105 int Red, Green, Blue;
10106 int *R = &Red, *G = &Green, *B = &Blue;
10120 Col = TColor((65536 * Blue) + (256 * Green) + Red);
10134 Col = TColor((65536 * Blue) + (256 * Green) + Red);
10158 AnsiString((
short)FirstTrack));
10159 bool LengthDifferent =
false, SpeedDifferent =
false;
10166 int EXArray[16][2] =
10168 {2, 4}, {6, 2}, {8, 6}, {4, 8},
10169 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
10172 int Index = -1, BrNum = -1, GrNum = -1, InLink, OutLink;
10173 Graphics::TBitmap *Bitmap;
10177 InLink = TrackElement.
Link[0];
10178 OutLink = TrackElement.
Link[1];
10182 InLink = TrackElement.
Link[2];
10183 OutLink = TrackElement.
Link[3];
10185 for(
int x = 0; x < 16; x++)
10187 if((InLink == EXArray[x][0] && OutLink == EXArray[x][1]) || (InLink == EXArray[x][1] && OutLink == EXArray[x][0]))
10194 throw Exception(
"Error, failed to find Index in TTrack::MarkOneLengthandSpeed");
10214 else if(TrackElement.
SpeedTag == 54)
10218 else if(TrackElement.
SpeedTag == 55)
10223 else if(Index == 0)
10229 else if(TrackElement.
SpeedTag == 58)
10233 else if(TrackElement.
SpeedTag == 59)
10238 else if(Index == 14)
10244 else if(TrackElement.
SpeedTag == 52)
10248 else if(TrackElement.
SpeedTag == 57)
10253 else if(Index == 15)
10259 else if(TrackElement.
SpeedTag == 53)
10263 else if(TrackElement.
SpeedTag == 56)
10277 if(LengthDifferent && SpeedDifferent)
10345 else if(LengthDifferent && !SpeedDifferent)
10492 AnsiString((
short)FirstTrack));
10493 LengthDifferent =
false;
10494 SpeedDifferent =
false;
10499 LengthDifferent =
true;
10503 SpeedDifferent =
true;
10505 if(LengthDifferent || SpeedDifferent)
10518 LengthDifferent =
true;
10522 SpeedDifferent =
true;
10524 if(LengthDifferent || SpeedDifferent)
10537 LengthDifferent =
true;
10541 SpeedDifferent =
true;
10543 if(LengthDifferent || SpeedDifferent)
10623 AnsiString TempName;
10624 int VecPos, StartVecPos, Count, EntryPos, StartEntryPos, ForwardNumber, ReverseNumber;
10625 bool ForwardSet, ReverseSet;
10627 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10632 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10637 ForwardSet =
false;
10638 ReverseSet =
false;
10672 for(
int y = 0; y < 2; y++)
10703 StartElement = TempElement;
10704 StartVecPos = VecPos;
10707 EntryPos = 1 - Dir;
10708 StartEntryPos = 1 - Dir;
10716 VecPos = TempElement.
Conn[1 - EntryPos];
10717 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
10719 EntryPos = TempEntryPos;
10740 ForwardNumber = ((Count + 1) / 2) + 1;
10741 ReverseNumber = (Count - ForwardNumber) + 1;
10743 EntryPos = 1 - Dir;
10744 TempElement = StartElement;
10745 VecPos = StartVecPos;
10746 if(Count == ForwardNumber)
10751 if(Count == ReverseNumber)
10759 VecPos = TempElement.
Conn[1 - EntryPos];
10760 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
10762 EntryPos = TempEntryPos;
10764 if(Count == ForwardNumber)
10769 if(Count == ReverseNumber)
10782 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10811 AnsiString TempName;
10812 std::list<unsigned int> NameList;
10813 std::list<AnsiString> ContinuationNameList;
10814 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10820 ContinuationNameList.push_back(
TrackElementAt(1597, x).ActiveTrackElementName);
10823 ContinuationNameList.sort();
10824 ContinuationNameList.unique();
10826 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10831 bool NameIsAContinuation =
false;
10832 if(std::find(ContinuationNameList.begin(), ContinuationNameList.end(), TempElement.
ActiveTrackElementName) != ContinuationNameList.end())
10834 NameIsAContinuation =
true;
10847 if(((TempElement.
Conn[2] > -1)) && (TempElement.
Conn[3] > -1) &&
10855 NameList.push_back(x);
10860 if((TempElement.
Conn[2] > -1) && (TempElement.
Conn[3] > -1) &&
10868 NameList.push_back(x);
10878 NameList.push_back(x);
10881 while(!NameList.empty())
10883 unsigned int a = NameList.front();
10884 NameList.pop_front();
11042 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
11098 if((TextH / 16) - 1 <
HLocMin)
11102 if((TextH / 16) + 1 >
HLocMax)
11106 if((TextV / 16) - 1 <
VLocMin)
11110 if((TextV / 16) + 1 >
VLocMax)
11140 void TTrack::UserGraphicMove(
int Caller,
int HPosInput,
int VPosInput,
int &UserGraphicItem,
int &UserGraphicMoveHPos,
int &UserGraphicMoveVPos,
11141 bool &UserGraphicFoundFlag)
11144 TUserGraphicVector::iterator UserGraphicPtr;
11146 UserGraphicFoundFlag =
false;
11153 if((HPosInput >= (*UserGraphicPtr).HPos) && (HPosInput < ((*UserGraphicPtr).HPos + (*UserGraphicPtr).Width)) && (VPosInput >=
11154 (*UserGraphicPtr).VPos) && (VPosInput < ((*UserGraphicPtr).VPos + (*UserGraphicPtr).Height)))
11156 UserGraphicItem = x;
11157 UserGraphicMoveHPos = (*UserGraphicPtr).HPos;
11158 UserGraphicMoveVPos = (*UserGraphicPtr).VPos;
11159 UserGraphicFoundFlag =
true;
11177 int SpeedTag = TrackElement.
SpeedTag;
11181 throw Exception(
"Error - SpeedTag value " + AnsiString(SpeedTag) +
" in RetrieveStripedNamedLocationGraphicsWhereRelevant");
11230 return(GraphicOutput);
11238 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
11241 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in TrackElementAt");
11254 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
InactiveTrackVector.size()) +
", At: " + AnsiString(At) +
11255 " in InactiveTrackElementAt");
11266 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
11268 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in BlankElementAt");
11293 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
11294 int FirstNamedExitPos, SecondNamedExitPos, FirstNamedLinkedExitPos, SecondNamedLinkedEntryPos;
11298 if(SNRange.first == SNRange.second)
11303 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
11305 if(SNIterator->second < 0)
11319 HVPair.first = InactiveElement.
HLoc;
11320 HVPair.second = InactiveElement.
VLoc;
11324 (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in OneStationLongEnoughForSplit (1)");
11326 int TVPos =
TrackMap.find(HVPair)->second;
11329 if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
11335 FirstNamedExitPos = 0;
11337 SecondNamedElement =
TrackElementAt(561, FirstNamedElement.
Conn[FirstNamedExitPos]);
11339 FirstNamedLinkedElement =
TrackElementAt(562, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
11340 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
11343 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11345 SecondNamedLinkedElement =
TrackElementAt(563, SecondNamedElement.
Conn[SecondNamedExitPos]);
11346 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
11347 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
11350 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
11360 FirstNamedExitPos = 1;
11362 SecondNamedElement =
TrackElementAt(564, FirstNamedElement.
Conn[FirstNamedExitPos]);
11364 FirstNamedLinkedElement =
TrackElementAt(565, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
11365 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
11368 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11370 SecondNamedLinkedElement =
TrackElementAt(566, SecondNamedElement.
Conn[SecondNamedExitPos]);
11371 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
11372 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
11375 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
11401 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
11402 int FirstNamedExitPos, SecondNamedEntryPos, SecondNamedExitPos;
11406 if(SNRange.first == SNRange.second)
11411 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
11413 if(SNIterator->second < 0)
11427 HVPair.first = InactiveElement.
HLoc;
11428 HVPair.second = InactiveElement.
VLoc;
11431 throw Exception (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in OneNonStationLongEnoughForSplit(1)");
11433 int TVPos =
TrackMap.find(HVPair)->second;
11436 if(((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1)) && ((FirstNamedElement.
Conn[2] == -1) || (FirstNamedElement.
Conn[3] == -1)))
11441 if((FirstNamedElement.
Conn[2] == -1) || (FirstNamedElement.
Conn[3] == -1))
11443 FirstNamedExitPos = 0;
11445 SecondNamedElement =
TrackElementAt(1611, FirstNamedElement.
Conn[FirstNamedExitPos]);
11448 SecondNamedEntryPos = FirstNamedElement.
ConnLinkPos[FirstNamedExitPos];
11449 if((SecondNamedEntryPos == 0) || (SecondNamedEntryPos == 1))
11451 SecondNamedExitPos = 1 - SecondNamedEntryPos;
11453 else if(SecondNamedEntryPos == 2)
11455 SecondNamedExitPos = 3;
11457 else if(SecondNamedEntryPos == 3)
11459 SecondNamedExitPos = 2;
11461 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11468 FirstNamedExitPos = 1;
11470 SecondNamedElement =
TrackElementAt(1612, FirstNamedElement.
Conn[FirstNamedExitPos]);
11473 SecondNamedEntryPos = FirstNamedElement.
ConnLinkPos[FirstNamedExitPos];
11474 if((SecondNamedEntryPos == 0) || (SecondNamedEntryPos == 1))
11476 SecondNamedExitPos = 1 - SecondNamedEntryPos;
11478 else if(SecondNamedEntryPos == 2)
11480 SecondNamedExitPos = 3;
11482 else if(SecondNamedEntryPos == 3)
11484 SecondNamedExitPos = 2;
11486 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11494 else if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
11496 FirstNamedExitPos = 2;
11498 SecondNamedElement =
TrackElementAt(1613, FirstNamedElement.
Conn[FirstNamedExitPos]);
11501 SecondNamedEntryPos = FirstNamedElement.
ConnLinkPos[FirstNamedExitPos];
11502 if((SecondNamedEntryPos == 0) || (SecondNamedEntryPos == 1))
11504 SecondNamedExitPos = 1 - SecondNamedEntryPos;
11506 else if(SecondNamedEntryPos == 2)
11508 SecondNamedExitPos = 3;
11510 else if(SecondNamedEntryPos == 3)
11512 SecondNamedExitPos = 2;
11514 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11521 FirstNamedExitPos = 3;
11523 SecondNamedElement =
TrackElementAt(1614, FirstNamedElement.
Conn[FirstNamedExitPos]);
11526 SecondNamedEntryPos = FirstNamedElement.
ConnLinkPos[FirstNamedExitPos];
11527 if((SecondNamedEntryPos == 0) || (SecondNamedEntryPos == 1))
11529 SecondNamedExitPos = 1 - SecondNamedEntryPos;
11531 else if(SecondNamedEntryPos == 2)
11533 SecondNamedExitPos = 3;
11535 else if(SecondNamedEntryPos == 3)
11537 SecondNamedExitPos = 2;
11539 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11556 int MidEntryPos,
int &FrontTrainFrontPos,
int &FrontTrainRearPos,
int &RearTrainFrontPos,
int &RearTrainRearPos,
bool &TemporaryDelay)
11564 LocationName + AnsiString(LeadElement) +
"," + AnsiString(LeadExitPos) +
"," + AnsiString(MidElement) +
"," + AnsiString(MidEntryPos));
11566 TemporaryDelay =
false;
11568 int FwdPos[3] = {LeadElement, -1, -1};
11569 int RwdPos[3] = {MidElement, -1, -1};
11572 int FwdPos1EntryPos, FwdPos1ExitPos, FwdPos2EntryPos, FwdPos2ExitPos, RwdPos1EntryPos, RwdPos1ExitPos, RwdPos2EntryPos, RwdPos2ExitPos;
11574 bool FwdDerail1 =
false, FwdDerail2 =
false, RwdDerail1 =
false, RwdDerail2 =
false;
11575 int NumFwdNamedElements = 0, NumFwdElements = 0, NumRwdNamedElements = 0, NumRwdElements = 1;
11578 NumRwdNamedElements = 1;
11581 FwdPos[1] = FwdPos0Element.
Conn[LeadExitPos];
11584 NumFwdElements = 1;
11588 NumFwdNamedElements = 1;
11590 FwdPos1EntryPos = FwdPos0Element.
ConnLinkPos[LeadExitPos];
11592 FwdPos[2] = FwdPos1Element.
Conn[FwdPos1ExitPos];
11595 NumFwdElements = 2;
11596 FwdPos2EntryPos = FwdPos1Element.
ConnLinkPos[FwdPos1ExitPos];
11601 NumFwdNamedElements = 2;
11607 RwdPos[1] = RwdPos0Element.
Conn[MidEntryPos];
11610 NumRwdElements = 2;
11614 NumRwdNamedElements = 2;
11616 RwdPos1ExitPos = RwdPos0Element.
ConnLinkPos[MidEntryPos];
11618 RwdPos[2] = RwdPos1Element.
Conn[RwdPos1EntryPos];
11621 NumRwdElements = 3;
11622 RwdPos2ExitPos = RwdPos1Element.
ConnLinkPos[RwdPos1EntryPos];
11627 NumRwdNamedElements = 3;
11634 if(NumFwdNamedElements == 2)
11636 FrontTrainFrontPos = FwdPos[2];
11637 FrontTrainRearPos = FwdPos[1];
11638 RearTrainFrontPos = LeadElement;
11639 RearTrainRearPos = MidElement;
11640 if(FwdDerail1 || FwdDerail2)
11642 TrainController->
StopTTClockMessage(159, HeadCode +
" unable to split at " + LocationName +
", points set wrongly ahead of train. Please change these points to allow the split.");
11643 TemporaryDelay =
true;
11649 TrainController->
StopTTClockMessage(160, HeadCode +
" unable to split at " + LocationName +
" because another train is obstructing ahead of this train. Please move the obstructing train to allow the split.");
11650 TemporaryDelay =
true;
11656 TrainController->
StopTTClockMessage(161, HeadCode +
" unable to split at " + LocationName +
" because another train is obstructing ahead of this train. Please move the obstructing train to allow the split.");
11657 TemporaryDelay =
true;
11665 else if((NumFwdNamedElements == 1) && (NumRwdNamedElements >= 1) && (NumRwdElements >= 2))
11667 FrontTrainFrontPos = FwdPos[1];
11668 FrontTrainRearPos = LeadElement;
11669 RearTrainFrontPos = MidElement;
11670 RearTrainRearPos = RwdPos[1];
11673 TrainController->
StopTTClockMessage(162, HeadCode +
" unable to split at " + LocationName +
", points set wrongly ahead of train. Please change these points to allow the split.");
11674 TemporaryDelay =
true;
11680 TrainController->
StopTTClockMessage(163, HeadCode +
" unable to split at " + LocationName +
", points set wrongly behind train. Please change these points to allow the split.");
11681 TemporaryDelay =
true;
11687 TrainController->
StopTTClockMessage(164, HeadCode +
" unable to split at " + LocationName +
" because another train is obstructing ahead of this train. Please move the obstructing train to allow the split.");
11688 TemporaryDelay =
true;
11694 TrainController->
StopTTClockMessage(165, HeadCode +
" unable to split at " + LocationName +
" because another train is obstructing behind this train. Please move the obstructing train to allow the split.");
11695 TemporaryDelay =
true;
11703 else if((NumRwdNamedElements >= 2) && (NumRwdElements == 3))
11705 FrontTrainFrontPos = LeadElement;
11706 FrontTrainRearPos = MidElement;
11707 RearTrainFrontPos = RwdPos[1];
11708 RearTrainRearPos = RwdPos[2];
11709 if(RwdDerail1 || RwdDerail2)
11711 TrainController->
StopTTClockMessage(166, HeadCode +
" unable to split at " + LocationName +
", points set wrongly behind train. Please change these points to allow the split.");
11712 TemporaryDelay =
true;
11718 TrainController->
StopTTClockMessage(167, HeadCode +
" unable to split at " + LocationName +
" because another train is obstructing behind this train. Please move the obstructing train to allow the split.");
11719 TemporaryDelay =
true;
11725 TrainController->
StopTTClockMessage(168, HeadCode +
" unable to split at " + LocationName +
" because another train is obstructing behind this train. Please move the obstructing train to allow the split.");
11726 TemporaryDelay =
true;
11735 else if((NumFwdNamedElements == 1) && (NumFwdElements == 2))
11737 FrontTrainFrontPos = FwdPos[2];
11738 FrontTrainRearPos = FwdPos[1];
11739 RearTrainFrontPos = LeadElement;
11740 RearTrainRearPos = MidElement;
11741 if(FwdDerail1 || FwdDerail2)
11743 TrainController->
StopTTClockMessage(169, HeadCode +
" unable to split at " + LocationName +
", points set wrongly ahead of train. Please change these points to allow the split.");
11744 TemporaryDelay =
true;
11750 TrainController->
StopTTClockMessage(170, HeadCode +
" unable to split at " + LocationName +
" because another train is obstructing ahead of this train. Please move the obstructing train to allow the split.");
11751 TemporaryDelay =
true;
11757 TrainController->
StopTTClockMessage(171, HeadCode +
" unable to split at " + LocationName +
" because another train is obstructing ahead of this train. Please move the obstructing train to allow the split.");
11758 TemporaryDelay =
true;
11766 else if((NumFwdElements >= 1) && (NumRwdNamedElements >= 1) && (NumRwdElements >= 2))
11768 FrontTrainFrontPos = FwdPos[1];
11769 FrontTrainRearPos = LeadElement;
11770 RearTrainFrontPos = MidElement;
11771 RearTrainRearPos = RwdPos[1];
11774 TrainController->
StopTTClockMessage(172, HeadCode +
" unable to split at " + LocationName +
", points set wrongly ahead of train. Please change these points to allow the split.");
11775 TemporaryDelay =
true;
11781 TrainController->
StopTTClockMessage(173, HeadCode +
" unable to split at " + LocationName +
", points set wrongly behind train. Please change these points to allow the split.");
11782 TemporaryDelay =
true;
11788 TrainController->
StopTTClockMessage(174, HeadCode +
" unable to split at " + LocationName +
" because another train is obstructing ahead of this train. Please move the obstructing train to allow the split.");
11789 TemporaryDelay =
true;
11795 TrainController->
StopTTClockMessage(175, HeadCode +
" unable to split at " + LocationName +
" because another train is obstructing behind this train. Please move the obstructing train to allow the split.");
11796 TemporaryDelay =
true;
11816 if(SNRange.first != SNRange.second)
11818 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
11820 if(SNIterator->second < 0)
11842 "," + AnsiString(SpeedTag));
11853 throw Exception(
"Error, FoundFlag false in PlatformOnSignalSide after IsPlatformOrNamedNonStationLocationPresent called successfully");
11883 else if(SpeedTag == 69)
11909 else if(SpeedTag == 70)
11935 else if(SpeedTag == 71)
11972 AnsiString(LinkPos) +
"," + AnsiString(OwnTrainID));
11973 if((LinkPos < 0) || (TrackPos < 0))
12005 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in SelectVectorAt");
12017 AnsiString(VLocIn) +
"," + AnsiString(LinkIn));
12018 bool FoundFlag =
false;
12033 int VLocHi = -2000000000, VLocLo = 2000000000, HLoc = 2000000000;
12034 bool FoundFlag =
false;
12059 VPosHi = 16 * VLocHi;
12060 VPosLo = 16 * VLocLo;
12079 AnsiString(EndTVPosition));
12090 int Link0Squares = ((EndElement.
HLoc - NewHLocLink0) * (EndElement.
HLoc - NewHLocLink0)) +
12091 ((EndElement.
VLoc - NewVLocLink0) * (EndElement.
VLoc - NewVLocLink0));
12092 int Link1Squares = ((EndElement.
HLoc - NewHLocLink1) * (EndElement.
HLoc - NewHLocLink1)) +
12093 ((EndElement.
VLoc - NewVLocLink1) * (EndElement.
VLoc - NewVLocLink1));
12095 if(Link0Squares <= Link1Squares)
12113 AnsiString(LinkPos));
12132 if((LinkPos == 1) && (TE.
Attribute == 0))
12137 else if(LinkPos == 1)
12143 else if((LinkPos == 3) && (TE.
Attribute == 1))
12148 else if(LinkPos == 3)
12155 else if(LinkPos == 0)
12160 else if(LinkPos == 1)
12165 else if(LinkPos == 2)
12170 else if(LinkPos == 3)
12175 throw Exception(
"Error, failure in GetExitPos");
12224 if((TE.
Link[0] == Link) || (TE.
Link[1] == Link))
12228 else if((TE.
Link[2] == Link) || (TE.
Link[3] == Link))
12270 "," + AnsiString(DiagonalLinkNumber));
12275 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(8, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
TrainOnLink(9, HLoc - 1, VLoc, 9, TrainID)))
12280 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(10, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
TrainOnLink(11, HLoc, VLoc - 1, 9, TrainID)))
12285 if(((DiagonalLinkNumber == 3) &&
TrainOnLink(12, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(13, HLoc + 1, VLoc, 7, TrainID)))
12290 if(((DiagonalLinkNumber == 7) &&
TrainOnLink(14, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(15, HLoc, VLoc + 1, 3, TrainID)))
12306 AnsiString JustFileName =
"";
12311 int LastDelim = UGI.
FileName.LastDelimiter(
'\\');
12318 JustFileName = UGI.
FileName.SubString(LastDelim + 1, UGI.
FileName.Length() - LastDelim);
12337 typedef std::list<int> TNamePosList;
12338 TNamePosList NamePosList;
12339 typedef TNamePosList::iterator TNPLIt;
12341 typedef std::list<int> TOnePlatList;
12342 TOnePlatList OnePlatList;
12343 typedef TOnePlatList::iterator TOPLIt;
12346 NamePosList.clear();
12347 OnePlatList.clear();
12348 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
12350 if(
TrackElementAt(988, x).ActiveTrackElementName == LocationName)
12352 NamePosList.push_back(x);
12357 if(!NamePosList.empty())
12359 OnePlatList.push_back(NamePosList.back());
12360 NamePosList.pop_back();
12362 while(!OnePlatList.empty())
12364 TempInt = OnePlatList.front();
12367 NPLIt = find(NamePosList.begin(), NamePosList.end(), TempElement.
Conn[0]);
12368 if(NPLIt != NamePosList.end() && ((TempElement.
Link[0] == 2) || (TempElement.
Link[0] == 4) || (TempElement.
Link[0] == 6) || (TempElement.
Link[0] == 8)))
12370 OnePlatList.push_back(TempElement.
Conn[0]);
12371 NamePosList.erase(NPLIt);
12373 NPLIt = find(NamePosList.begin(), NamePosList.end(), TempElement.
Conn[1]);
12374 if(NPLIt != NamePosList.end() && ((TempElement.
Link[1] == 2) || (TempElement.
Link[1] == 4) || (TempElement.
Link[1] == 6) || (TempElement.
Link[1] == 8)))
12376 OnePlatList.push_back(TempElement.
Conn[1]);
12377 NamePosList.erase(NPLIt);
12380 OnePlatList.erase(OnePlatList.begin());
12381 if(OnePlatList.empty())
12384 if(!NamePosList.empty())
12386 OnePlatList.push_back(NamePosList.back());
12387 NamePosList.pop_back();
12403 throw Exception(
"Element at " + AnsiString(FPVIt->TVPos) +
" not signal in RepairFailedSignals");
12407 throw Exception(
"Signals not failed at " + AnsiString(FPVIt->TVPos) +
" in RepairFailedSignals");
12435 throw Exception(
"Element at " + AnsiString(FPVIt->TVPos) +
" not points in RepairFailedPoints");
12439 throw Exception(
"Points not failed at " + AnsiString(FPVIt->TVPos) +
" in RepairFailedPoints");
12465 throw Exception(
"Element at " + AnsiString(FPVIt->TVPos) +
" not simple in RepairFailedPoints");
12469 throw Exception(
"No TSR at " + AnsiString(FPVIt->TVPos) +
" in RepairTSR");
12491 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
12510 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
UserGraphicVector.size()) +
", At: " + AnsiString(At) +
" in UserGraphicVectorAt");
12525 throw Exception(
"Return value negative in call to LastElementNumber");
12537 throw Exception(
"PrefDirVector empty in call to LastElementPtr");
12551 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedPrefDirElementAt");
12563 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
12564 " in GetModifiablePrefDirElementAt");
12574 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
12576 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedSearchElementAt");
12586 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
12588 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableSearchElementAt");
12605 int TrackVectorPosition;
12656 FinishElement =
false;
12657 int TrackVectorPosition;
12679 if(TrackElement.
HLoc >= StartPrefDirElement.
HLoc)
12689 if(TrackElement.
VLoc >= StartPrefDirElement.
VLoc)
12712 for(
int x = 0; x < 4; x++)
12735 FinishElement =
true;
12743 for(
int x = 0; x < 4; x++)
12755 FinishElement =
true;
12763 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
12770 .ELinkPos] ==
Lead))
12786 FinishElement =
true;
12805 FinishElement =
true;
12824 FinishElement =
true;
12839 FinishElement =
true;
12848 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
12864 FinishElement =
true;
12870 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
12893 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition));
12894 int VectorCount = 0;
12898 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
12900 for(
int x = 0; x < VectorCount; x++)
12907 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
12911 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
12912 SearchElement.
ELinkPos = NextELinkPos;
12933 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
12935 SearchElement.
XLinkPos = NextXLinkPos;
12961 for(
int x = 0; x < VectorCount; x++)
12973 for(
int x = 0; x < VectorCount; x++)
12987 for(
int x = 0; x < VectorCount; x++)
13001 for(
int x = 0; x < VectorCount; x++)
13011 for(
int x = 0; x < VectorCount; x++)
13022 SearchElement.
XLink = SearchElement.
Link[1];
13041 SearchElement.
XLink = SearchElement.
Link[3];
13054 for(
int x = 0; x < VectorCount; x++)
13069 XLinkPos = NextXLinkPos;
13070 CurrentTrackElement = SearchElement;
13089 throw Exception(
"Error, SearchVector empty");
13096 for(
int x = 0; x < 4; x++)
13149 throw Exception(
"Error in EntryExitNumber 1");
13168 if(PrefDirElement.
XLink == -1)
13180 if(PrefDirElement.
XLink != -1)
13184 throw Exception(
"Error in EntryExitNumber 2");
13222 LeadingPoints =
false;
13250 LeadingPoints =
true;
13266 AnsiString ErrorString;
13267 bool Error =
false;
13274 ErrorString =
"HLoc";
13280 ErrorString =
"VLoc";
13286 ErrorString =
"ELink";
13292 ErrorString =
"ELinkPos";
13298 ErrorString =
"XLink";
13304 ErrorString =
"XLinkPos";
13310 ErrorString =
"Tag";
13316 ErrorString =
"TrackVectorPosition";
13322 ErrorString =
"EXNumber";
13329 ErrorString =
"CheckCount";
13336 ErrorString =
"EntryGraphicPtr";
13342 ErrorString =
"EntryDirectionGraphicPtr";
13351 ErrorString =
"Last XLink not connected to this element";
13358 throw Exception(
"Error at " + AnsiString(Position) +
" " + ErrorString);
13382 for(
int PrefDirVecPos = (
PrefDirVector.size() - 1); PrefDirVecPos >= (int)x; PrefDirVecPos--)
13439 AnsiString((
short)BuildingPrefDir));
13442 if(PrefDirSize() == 0)
13447 for(
unsigned int x = 0; x < PrefDirSize(); x++)
13459 Disp->PlotOutput(12, (TempPrefDirElement.
HLoc * 16), (TempPrefDirElement.
VLoc * 16), TempPrefDirElement.
EXGraphicPtr);
13471 if(x == (PrefDirSize() - 1))
13480 if((PrefDirRoute ==
PrefDirCall) && BuildingPrefDir)
13482 HPos = GetFixedPrefDirElementAt(4, 0).
HLoc * 16;
13483 VPos = GetFixedPrefDirElementAt(5, 0).VLoc * 16;
13484 Disp->Rectangle(1, HPos, VPos,
clB0G0R5, 2, 2);
13486 if(PrefDirSize() > 1)
13488 unsigned int LatestPos = PrefDirSize() - 1;
13489 HPos = GetFixedPrefDirElementAt(6, LatestPos).HLoc * 16;
13490 VPos = GetFixedPrefDirElementAt(7, LatestPos).VLoc * 16;
13491 Disp->Rectangle(2, HPos, VPos,
clB5G0R0, 4, 2);
13512 int H, V, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
13515 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
13519 H = MMIT->first.first;
13520 V = MMIT->first.second;
13523 if(PrefDirPos0 > -1)
13527 if(PrefDirPos1 > -1)
13531 if(PrefDirPos2 > -1)
13535 if(PrefDirPos3 > -1)
13539 if(PrefDirPos3 > -1)
13555 else if(PrefDirPos2 > -1)
13597 else if(PrefDirPos1 > -1)
13620 else if(PrefDirPos0 > -1)
13639 int NumberOfPrefDirElements = 0;
13642 for(
int x = 0; x < NumberOfPrefDirElements; x++)
13644 VecFile >> TempInt;
13647 VecFile >> TempInt;
13648 LoadPrefDirElement.
ELink = TempInt;
13649 VecFile >> TempInt;
13650 LoadPrefDirElement.
ELinkPos = TempInt;
13651 VecFile >> TempInt;
13652 LoadPrefDirElement.
XLink = TempInt;
13653 VecFile >> TempInt;
13654 LoadPrefDirElement.
XLinkPos = TempInt;
13655 VecFile >> TempInt;
13656 LoadPrefDirElement.
EXNumber = TempInt;
13657 VecFile >> TempInt;
13662 if(!(LoadPrefDirElement.
IsARoute))
13688 int NumberOfPrefDirElements = 0;
13691 for(
int x = 0; x < NumberOfPrefDirElements; x++)
13693 VecFile >> TempInt;
13694 VecFile >> TempInt;
13697 VecFile >> TempInt;
13698 LoadPrefDirElement.
ELink = TempInt;
13699 VecFile >> TempInt;
13700 LoadPrefDirElement.
ELinkPos = TempInt;
13701 VecFile >> TempInt;
13702 LoadPrefDirElement.
XLink = TempInt;
13703 VecFile >> TempInt;
13704 LoadPrefDirElement.
XLinkPos = TempInt;
13705 VecFile >> TempInt;
13706 LoadPrefDirElement.
EXNumber = TempInt;
13707 VecFile >> TempInt;
13712 if(!(LoadPrefDirElement.
IsARoute))
13740 int NumberOfPrefDirElements = 0;
13743 if((NumberOfPrefDirElements < 0) || (NumberOfPrefDirElements > 1000000))
13748 for(
int x = 0; x < NumberOfPrefDirElements; x++)
13755 VecFile >> TempInt;
13756 if((TempInt < 0) || (TempInt >= NumberOfActiveElements))
13761 VecFile >> TempInt;
13762 if((TempInt < -1) || (TempInt > 9))
13767 VecFile >> TempInt;
13768 if((TempInt < -1) || (TempInt > 3))
13773 VecFile >> TempInt;
13774 if((TempInt < -1) || (TempInt > 9))
13779 VecFile >> TempInt;
13780 if((TempInt < -1) || (TempInt > 3))
13785 VecFile >> TempInt;
13786 if((TempInt < -1) || (TempInt > 27))
13791 VecFile >> TempInt;
13799 VecFile >> TempInt;
13800 if((TempInt != 0) && (TempInt != 1))
13805 VecFile >> TempInt;
13806 if((TempInt != 0) && (TempInt != 1))
13811 VecFile >> TempInt;
13812 if((TempInt != 0) && (TempInt != 1))
13835 for(
int y = 0; y < NumberOfPrefDirElements; y++)
13837 VecFile << y <<
'\n';
13838 VecFile <<
PrefDirVector.at(y).TrackVectorPosition <<
'\n';
13848 if(y == (NumberOfPrefDirElements - 1))
13850 VecFile <<
"************" <<
'\0' <<
'\n';
13854 VecFile <<
"******" <<
'\0' <<
'\n';
13868 for(
int y = 0; y < NumberOfSearchElements; y++)
13870 VecFile << y <<
'\n';
13871 VecFile <<
SearchVector.at(y).TrackVectorPosition <<
'\n';
13881 if(y == (NumberOfSearchElements - 1))
13883 VecFile <<
"************" <<
'\0' <<
'\n';
13887 VecFile <<
"******" <<
'\0' <<
'\n';
14000 bool AlreadyPresent, FoundFlag;
14001 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
14003 for(
unsigned int x = 0; x < InputPrefDir->
PrefDirSize(); x++)
14007 AlreadyPresent =
false;
14012 AlreadyPresent =
true;
14016 AlreadyPresent =
true;
14020 AlreadyPresent =
true;
14024 AlreadyPresent =
true;
14027 if(!AlreadyPresent)
14074 for(
unsigned int z = 0; z < 4; z++)
14082 throw Exception(
"Error in RebuildPrefDirVector - PrefDirVector is unsafe");
14096 bool DiscrepancyFound =
false;
14107 DiscrepancyFound =
true;
14112 DiscrepancyFound =
true;
14117 DiscrepancyFound =
true;
14122 DiscrepancyFound =
true;
14127 DiscrepancyFound =
true;
14133 DiscrepancyFound =
true;
14136 if(DiscrepancyFound)
14138 ShowMessage(
"Discrepancies found in the preferred direction file, preferred directions will be cleared");
14153 bool DiscrepancyFound =
false;
14164 DiscrepancyFound =
true;
14168 DiscrepancyFound =
true;
14173 DiscrepancyFound =
true;
14178 DiscrepancyFound =
true;
14183 DiscrepancyFound =
true;
14189 DiscrepancyFound =
true;
14193 return(!DiscrepancyFound);
14205 bool FoundFlag =
false;
14206 int PrefDir0, PrefDir1, PrefDir2, PrefDir3;
14214 throw Exception(
"CheckPrefDir4MultiMap Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
14215 " in PrefDir4MultiMap, Caller=" + (AnsiString)Caller);
14217 if((PrefDir0 != (
int)a) && (PrefDir1 != (
int)a) && (PrefDir2 != (
int)a) && (PrefDir3 != (
int)a))
14219 throw Exception(
"CheckPrefDir4MultiMap Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
14220 (AnsiString)CheckElement.
VLoc +
" Map values=" + (AnsiString)PrefDir0 +
", " + (AnsiString)PrefDir1 +
", " + (AnsiString)PrefDir2 +
", " +
14221 (AnsiString)PrefDir3 +
" PrefDirVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
14226 throw Exception(
"CheckPrefDir4MultiMap Error - Map Size=" + (AnsiString)
PrefDirVector.size() +
" PrefDirVectorSize=" + (AnsiString)
PrefDirVector.size()
14227 +
" Caller=" + (AnsiString)Caller);
14253 PrefDirMapKeyPair.first = HLoc;
14254 PrefDirMapKeyPair.second = VLoc;
14255 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
14258 if(ItPair.first == ItPair.second)
14266 PrefDirPos0 = ItPair.first->second;
14268 if(ItPair.first == ItPair.second)
14273 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
14275 PrefDirPos1 = ItPair.first->second;
14278 if(ItPair.first == ItPair.second)
14283 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
14285 PrefDirPos2 = ItPair.first->second;
14288 if(ItPair.first == ItPair.second)
14293 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
14295 PrefDirPos3 = ItPair.first->second;
14310 +
"," + AnsiString(LinkNumberPos));
14312 int PD0, PD1, PD2, PD3;
14313 if(
PrefDirVector.at(PrefDirVectorNumber).Conn[LinkNumberPos] > -1)
14317 PD0, PD1, PD2, PD3);
14329 LinkedPrefDirVectorNumber = PD0;
14338 LinkedPrefDirVectorNumber = PD1;
14348 LinkedPrefDirVectorNumber = PD0;
14357 LinkedPrefDirVectorNumber = PD1;
14366 LinkedPrefDirVectorNumber = PD2;
14375 LinkedPrefDirVectorNumber = PD3;
14380 LinkedPrefDirVectorNumber = -1;
14386 LinkedPrefDirVectorNumber = -1;
14391 catch(
const Exception &e)
14393 LinkedPrefDirVectorNumber = -1;
14408 +
"," + AnsiString(LinkNumberPos));
14410 int PD0, PD1, PD2, PD3;
14411 if(
PrefDirVector.at(PrefDirVectorNumber).Conn[LinkNumberPos] > -1)
14415 PD0, PD1, PD2, PD3);
14428 LinkedPrefDirVectorNumber = PD0;
14438 LinkedPrefDirVectorNumber = PD1;
14443 LinkedPrefDirVectorNumber = -1;
14451 LinkedPrefDirVectorNumber = PD0;
14460 LinkedPrefDirVectorNumber = PD1;
14469 LinkedPrefDirVectorNumber = PD2;
14478 LinkedPrefDirVectorNumber = PD3;
14483 LinkedPrefDirVectorNumber = -1;
14489 LinkedPrefDirVectorNumber = -1;
14494 catch(
const Exception &e)
14496 LinkedPrefDirVectorNumber = -1;
14508 int PD0, PD1, PD2, PD3;
14560 THVPair PrefDir4MultiMapKeyPair;
14563 PrefDir4MultiMapKeyPair.first = LoadPrefDirElement.
HLoc;
14564 PrefDir4MultiMapKeyPair.second = LoadPrefDirElement.
VLoc;
14565 PrefDir4MultiMapEntry.first = PrefDir4MultiMapKeyPair;
14588 throw Exception(
"Failed to find PrefDir4MultiMap erase element");
14607 AnsiString(ErasedElementNumber));
14612 if(MapPtr->second > ErasedElementNumber)
14634 throw Exception(
"PrefDirVectorPosition out of range");
14637 THVPair PrefDir4MultiMapKeyPair;
14639 PrefDir4MultiMapKeyPair.first = PrefDirElement.
HLoc;
14640 PrefDir4MultiMapKeyPair.second = PrefDirElement.
VLoc;
14641 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
14644 if(ItPair.first == ItPair.second)
14647 return(ItPair.first);
14651 if(ItPair.first->second == PrefDirVectorPosition)
14655 return(ItPair.first);
14658 if(ItPair.first == ItPair.second)
14661 return(ItPair.first);
14663 if(ItPair.first->second == PrefDirVectorPosition)
14667 return(ItPair.first);
14670 if(ItPair.first == ItPair.second)
14673 return(ItPair.first);
14675 if(ItPair.first->second == PrefDirVectorPosition)
14679 return(ItPair.first);
14682 if(ItPair.first == ItPair.second)
14685 return(ItPair.first);
14687 if(ItPair.first->second == PrefDirVectorPosition)
14691 return(ItPair.first);
14695 return(ItPair.first);
14708 THVPair PrefDir4MultiMapKeyPair;
14710 PrefDir4MultiMapKeyPair.first = HLoc;
14711 PrefDir4MultiMapKeyPair.second = VLoc;
14712 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
14715 if(ItPair.first == ItPair.second)
14723 return(ItPair.first->second);
14732 bool ErasedFlag =
false;
14734 if(ErasedTrackVectorPosition > -1)
14743 ErasedFlag =
false;
14745 if(
PrefDirVector.at(x).TrackVectorPosition == ErasedTrackVectorPosition)
14750 else if(
PrefDirVector.at(x).Conn[0] == ErasedTrackVectorPosition)
14755 else if(
PrefDirVector.at(x).Conn[1] == ErasedTrackVectorPosition)
14760 else if(
PrefDirVector.at(x).Conn[2] == ErasedTrackVectorPosition)
14765 else if(
PrefDirVector.at(x).Conn[3] == ErasedTrackVectorPosition)
14773 if(
PrefDirVector.at(x).TrackVectorPosition > ErasedTrackVectorPosition)
14777 if(
PrefDirVector.at(x).Conn[0] > ErasedTrackVectorPosition)
14781 if(
PrefDirVector.at(x).Conn[1] > ErasedTrackVectorPosition)
14785 if(
PrefDirVector.at(x).Conn[2] > ErasedTrackVectorPosition)
14789 if(
PrefDirVector.at(x).Conn[3] > ErasedTrackVectorPosition)
14804 OverallDistance = 0;
14805 OverallSpeedLimit = 0;
14806 LeadingPointsAtLastElement =
false;
14814 LeadingPointsAtLastElement =
true;
14823 OverallDistance += PrefDirElement.
Length23;
14824 if(OverallSpeedLimit != -1)
14834 OverallSpeedLimit = -1;
14841 OverallDistance += PrefDirElement.
Length01;
14842 if(OverallSpeedLimit != -1)
14852 OverallSpeedLimit = -1;
14871 int H, V, HLoc, VLoc, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
14874 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
14878 HLoc = MMIT->first.first;
14879 VLoc = MMIT->first.second;
14884 if(PrefDirPos0 > -1)
14888 if(PrefDirPos1 > -1)
14892 if(PrefDirPos2 > -1)
14896 if(PrefDirPos3 > -1)
14900 if(PrefDirPos3 > -1)
14903 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
14905 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
14907 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
14909 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement3.
GetRouteGraphicPtr(
false,
true));
14916 else if(PrefDirPos2 > -1)
14921 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
14923 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
14925 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
false));
14934 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
14936 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
14938 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
14947 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
14949 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
14951 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
14958 else if(PrefDirPos1 > -1)
14963 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
14965 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
14973 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
14975 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
14981 else if(PrefDirPos0 > -1)
14983 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
15000 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
15003 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
15025 if(PrefDirPos0 > -1)
15029 if(PrefDirPos1 > -1)
15033 if(PrefDirPos2 > -1)
15037 if(PrefDirPos3 > -1)
15041 if(PrefDirPos3 > -1)
15046 else if(PrefDirPos2 > -1)
15048 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos) || (PrefDirElement2.
XLinkPos == EntryPos))
15059 else if(PrefDirPos1 > -1)
15061 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos))
15072 else if(PrefDirPos0 > -1)
15074 if(PrefDirElement0.
XLinkPos == EntryPos)
15111 ElementIn.
VLoc +
"," + XLink);
15113 bool TrackFoundFlag;
15116 if((XLink == 2) || (XLink == 4) || (XLink == 6) || (XLink == 8))
15128 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
15138 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
15152 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
15162 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
15176 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
15186 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
15200 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
15210 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
15233 bool FoundFlag, ContFlag, FoundElements =
false;
15234 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
15239 LastIteratorValue++;
15265 if(PDVIt->XLinkPos == 0)
15270 StartElement = *PDVIt;
15279 int NextTrackVectorPosition = PDVIt->
Conn[PDVIt->GetXLinkPos()];
15281 Track->
TrackElementAt(879, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
15282 if(PrefDirPos0 == -1)
15286 bool NextElementFoundFlag =
false;
15290 NextElementFoundFlag =
true;
15292 if(PrefDirPos1 > -1)
15297 NextElementFoundFlag =
true;
15300 if(PrefDirPos2 > -1)
15305 NextElementFoundFlag =
true;
15308 if(PrefDirPos3 > -1)
15313 NextElementFoundFlag =
true;
15316 if(!NextElementFoundFlag)
15346 EndElement = NextElement;
15350 NextTrackVectorPosition = NextElement.
Conn[NextElement.
GetXLinkPos()];
15352 Track->
TrackElementAt(881, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
15353 if(PrefDirPos0 == -1)
15363 if(PrefDirPos1 > -1)
15371 if(PrefDirPos2 > -1)
15379 if(PrefDirPos3 > -1)
15410 FoundElements =
true;
15444 AnsiString(VLoc) +
"," + AnsiString((
short)AutoSigsFlag));
15446 int TrackVectorPosition;
15482 int LockedVectorNumber;
15505 bool InPrefDirFlag =
false;
15508 int PrefDirPos0 = -1;
15509 int PrefDirPos1 = -1;
15510 int PrefDirPos2 = -1;
15511 int PrefDirPos3 = -1;
15515 int PrefDirVecPos[4] =
15517 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
15520 for(
int x = 0; x < 4; x++)
15522 int b = PrefDirVecPos[x];
15532 InPrefDirFlag =
true;
15545 TrainController->
StopTTClockMessage(12,
"Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
15553 if(DummyPair.first > -1)
15555 throw Exception(
"Selection in two routes - should never happen!");
15557 if(RoutePair.first > -1)
15633 IDInt &ReqPosRouteID,
bool &PointsChanged)
15667 AnsiString(VLoc) +
"," + AnsiString((
short)ConsecSignals) +
"," + AnsiString((
short)AutoSigsFlag));
15669 int NewFailedPointsTVPos = -1;
15718 bool InPrefDirFlag =
false;
15721 int PrefDirPos0 = -1;
15722 int PrefDirPos1 = -1;
15723 int PrefDirPos2 = -1;
15724 int PrefDirPos3 = -1;
15727 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
15728 int PrefDirVecPos[4] =
15730 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
15733 for(
int x = 0; x < 4; x++)
15735 int b = PrefDirVecPos[x];
15738 InPrefDirFlag =
true;
15751 TrainController->
StopTTClockMessage(23,
"Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
15760 if(RoutePair.first > -1)
15762 if(RoutePair.second != 0)
15779 EndElement1 = RouteElement;
15780 EndElement2 = BlankElement;
15875 AutoSigsFlag,
false))
15880 if(NewFailedPointsTVPos > -1)
15884 " failed during route setting.");
15888 PointsChanged =
true;
15911 AutoSigsFlag,
false))
15916 if(NewFailedPointsTVPos > -1)
15920 " failed during route setting.");
15924 PointsChanged =
true;
15942 AutoSigsFlag,
false))
15947 if(NewFailedPointsTVPos > -1)
15951 " failed during route setting.");
15955 PointsChanged =
true;
15979 AutoSigsFlag,
false))
15984 if(NewFailedPointsTVPos > -1)
15988 " failed during route setting.");
15992 PointsChanged =
true;
16001 AutoSigsFlag,
false))
16006 if(NewFailedPointsTVPos > -1)
16010 " failed during route setting.");
16014 PointsChanged =
true;
16025 AutoSigsFlag,
false))
16030 if(NewFailedPointsTVPos > -1)
16034 " failed during route setting.");
16038 PointsChanged =
true;
16044 AutoSigsFlag,
false))
16049 if(NewFailedPointsTVPos > -1)
16053 " failed during route setting.");
16057 PointsChanged =
true;
16068 AutoSigsFlag,
false))
16073 if(NewFailedPointsTVPos > -1)
16077 " failed during route setting.");
16081 PointsChanged =
true;
16135 TOnePrefDir *EveryPrefDir,
bool ConsecSignals,
int EndPosition,
bool AutoSigsFlag,
bool RecursiveCall)
16187 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString(
ReqPosRouteID.
GetInt()) +
"," + AnsiString(EndPosition) +
"," +
16188 AnsiString((
short)AutoSigsFlag) +
"," + AnsiString((
short)RecursiveCall));
16189 int VectorCount = 0;
16198 if((PrefDirElement.
XLink == 1) || (PrefDirElement.
XLink == 3) || (PrefDirElement.
XLink == 7) || (PrefDirElement.
XLink == 9))
16202 for(
int x = 0; x < VectorCount; x++)
16210 bool FirstPass =
true;
16220 for(
int x = 0; x < VectorCount; x++)
16229 for(
int x = 0; x < VectorCount; x++)
16241 for(
int x = 0; x < VectorCount; x++)
16249 int NextPosition = PrefDirElement.
Conn[XLinkPos];
16253 int NextELinkPos = PrefDirElement.
ConnLinkPos[XLinkPos];
16254 SearchElement.
ELinkPos = NextELinkPos;
16255 SearchElement.
ELink = SearchElement.
Link[NextELinkPos];
16276 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
16278 SearchElement.
XLinkPos = NextXLinkPos;
16296 for(
int x = 0; x < VectorCount; x++)
16312 for(
int x = 0; x < VectorCount; x++)
16326 if(RoutePair.first > -1)
16335 for(
int x = 0; x < VectorCount; x++)
16344 if(SecondPair.first > -1)
16353 for(
int x = 0; x < VectorCount; x++)
16367 for(
int x = 0; x < VectorCount; x++)
16378 for(
int x = 0; x < VectorCount; x++)
16387 for(
int x = 0; x < VectorCount; x++)
16396 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16400 for(
int x = 0; x < VectorCount; x++)
16410 bool InPrefDirFlag =
false;
16411 PrefDirElement1 = BlankElement;
16412 PrefDirElement2 = BlankElement;
16415 int PrefDirPos0 = -1;
16416 int PrefDirPos1 = -1;
16417 int PrefDirPos2 = -1;
16418 int PrefDirPos3 = -1;
16421 int PrefDirVecPos[4] =
16423 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
16425 for(
int x = 0; x < 4; x++)
16427 int b = PrefDirVecPos[x];
16430 InPrefDirFlag =
true;
16443 for(
int x = 0; x < VectorCount; x++)
16455 for(
int x = 0; x < VectorCount; x++)
16471 for(
int x = 0; x < VectorCount; x++)
16482 for(
int x = 0; x < VectorCount; x++)
16502 for(
int x = 0; x < VectorCount; x++)
16515 for(
int x = 0; x < VectorCount; x++)
16529 for(
int x = 0; x < VectorCount; x++)
16539 for(
int x = 0; x < VectorCount; x++)
16570 for(
int x = 0; x < VectorCount; x++)
16579 for(
int x = 0; x < VectorCount; x++)
16591 int SearchPos1 = SearchElement.
Attribute + 1;
16593 if(SearchPos1 == 2)
16597 if(SearchPos1 == 1)
16605 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
16606 SearchElement.
XLinkPos = SearchPos1;
16607 InPrefDirFlag =
false;
16608 if(SearchElement.
XLink == PrefDirElement1.
XLink)
16610 SearchElement = PrefDirElement1;
16611 InPrefDirFlag =
true;
16613 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
16615 SearchElement = PrefDirElement2;
16616 InPrefDirFlag =
true;
16622 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16626 for(
int x = 0; x < VectorCount; x++)
16644 AutoSigsFlag,
true))
16653 for(
int x = 0; x < VectorCount; x++)
16662 for(
int x = 0; x < VectorCount; x++)
16682 for(
int x = 0; x < VectorCount; x++)
16692 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
16693 SearchElement.
XLinkPos = SearchPos2;
16694 if(SearchElement.
XLink == PrefDirElement1.
XLink)
16696 SearchElement = PrefDirElement1;
16698 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
16700 SearchElement = PrefDirElement2;
16704 for(
int x = 0; x < VectorCount; x++)
16712 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16716 for(
int x = 0; x < VectorCount; x++)
16735 AutoSigsFlag,
true))
16744 for(
int x = 0; x < VectorCount; x++)
16753 for(
int x = 0; x < VectorCount; x++)
16765 for(
int x = 0; x < VectorCount; x++)
16775 SearchElement = PrefDirElement1;
16784 XLinkPos = SearchElement.
XLinkPos;
16785 PrefDirElement = SearchElement;
16842 unsigned int TruncatePrefDirPosition = 0;
16915 throw Exception(
"Error - failed to validate extended route for preferred route");
16970 throw Exception(
"Error - failed to validate single route for preferred route");
17015 AnsiString(VLoc) +
"," + AnsiString((
short)Callon));
17017 int TrackVectorPosition;
17054 int LockedVectorNumber;
17088 PrefDirElement1.
ELink = PrefDirElement1.
Link[0];
17089 PrefDirElement1.
XLink = PrefDirElement1.
Link[1];
17092 throw Exception(
"Error, No EXNumber for PrefDirElement1 in GetNonPreferredRouteStartElement");
17098 PrefDirElement2.
ELink = PrefDirElement2.
Link[1];
17099 PrefDirElement2.
XLink = PrefDirElement2.
Link[0];
17102 throw Exception(
"Error, No EXNumber for PrefDirElement2 in GetNonPreferredRouteStartElement");
17116 if(RoutePair.first > -1)
17251 int NewFailedPointsTVPos = -1;
17316 EndElement1.
ELink = EndElement1.
Link[0];
17317 EndElement1.
XLink = EndElement1.
Link[1];
17320 throw Exception(
"Error, No EXNumber for EndElement1 in GetNonPreferredRouteStartElement");
17325 EndElement2.
ELink = EndElement2.
Link[1];
17326 EndElement2.
XLink = EndElement2.
Link[0];
17329 throw Exception(
"Error, No EXNumber for EndElement2 in GetNonPreferredRouteStartElement");
17373 if(RoutePair.first > -1)
17375 if(RoutePair.second != 0)
17398 EndElement2 = BlankElement;
17483 if(NewFailedPointsTVPos > -1)
17487 " failed during route setting.");
17491 PointsChanged =
true;
17517 if(NewFailedPointsTVPos > -1)
17521 " failed during route setting.");
17525 PointsChanged =
true;
17547 if(NewFailedPointsTVPos > -1)
17551 " failed during route setting.");
17555 PointsChanged =
true;
17581 if(NewFailedPointsTVPos > -1)
17585 " failed during route setting.");
17589 PointsChanged =
true;
17603 if(NewFailedPointsTVPos > -1)
17607 " failed during route setting.");
17611 PointsChanged =
true;
17651 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString() +
"," + AnsiString(
ReqPosRouteID.
GetInt()));
17652 int VectorCount = 0;
17655 if((CurrentTrackElement.
Link[XLinkPos] == 1) || (CurrentTrackElement.
Link[XLinkPos] == 3) || (CurrentTrackElement.
Link[XLinkPos] == 7) ||
17656 (CurrentTrackElement.
Link[XLinkPos] == 9))
17660 for(
int x = 0; x < VectorCount; x++)
17672 for(
int x = 0; x < VectorCount; x++)
17679 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
17681 for(
int x = 0; x < VectorCount; x++)
17688 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
17692 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
17693 SearchElement.
ELinkPos = NextELinkPos;
17714 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
17716 SearchElement.
XLinkPos = NextXLinkPos;
17734 for(
int x = 0; x < VectorCount; x++)
17750 for(
int x = 0; x < VectorCount; x++)
17764 if(RoutePair.first > -1)
17773 for(
int x = 0; x < VectorCount; x++)
17782 if(SecondPair.first > -1)
17791 for(
int x = 0; x < VectorCount; x++)
17805 for(
int x = 0; x < VectorCount; x++)
17816 for(
int x = 0; x < VectorCount; x++)
17825 for(
int x = 0; x < VectorCount; x++)
17834 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
17838 for(
int x = 0; x < VectorCount; x++)
17851 for(
int x = 0; x < VectorCount; x++)
17879 for(
int x = 0; x < VectorCount; x++)
17892 for(
int x = 0; x < VectorCount; x++)
17902 for(
int x = 0; x < VectorCount; x++)
17927 for(
int x = 0; x < VectorCount; x++)
17936 for(
int x = 0; x < VectorCount; x++)
17949 int SearchPos1 = SearchElement.
Attribute + 1;
17951 if(SearchPos1 == 2)
17955 if(SearchPos1 == 1)
17964 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
17965 SearchElement.
XLinkPos = SearchPos1;
17967 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
17971 for(
int x = 0; x < VectorCount; x++)
17989 for(
int x = 0; x < VectorCount; x++)
18005 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
18006 SearchElement.
XLinkPos = SearchPos2;
18008 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
18012 for(
int x = 0; x < VectorCount; x++)
18028 for(
int x = 0; x < VectorCount; x++)
18040 for(
int x = 0; x < VectorCount; x++)
18055 CurrentTrackElement = SearchElement;
18056 XLinkPos = SearchElement.
XLinkPos;
18078 throw Exception(
"Error, SearchVector empty");
18090 for(
int x = 0; x < 4; x++)
18132 throw Exception(
"Error in EntryExitNumber 3");
18187 unsigned int TruncatePrefDirPosition = 0;
18247 throw Exception(
"Failed to validate extended route for nonpreferred route");
18292 throw Exception(
"Failed to validate single route for nonpreferred route");
18312 if(!PrefDirVector.empty())
18316 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 1) || (PrefDirPtr->XLinkPos == 1)))
18321 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 3) || (PrefDirPtr->XLinkPos == 3)))
18338 if(!PrefDirVector.empty())
18343 GetFixedPrefDirElementAt(193, 0).XLinkPos, RouteNumber);
18360 NewFailedPointsTVPos = -1;
18361 bool PointsChanged =
false;
18369 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 1) || (SearchPtr->XLinkPos == 1)))
18379 NewFailedPointsTVPos = SearchPtr->TrackVectorPosition;
18380 IFE.
TVPos = NewFailedPointsTVPos;
18399 PointsChanged =
true;
18402 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 3) || (SearchPtr->XLinkPos == 3)))
18412 NewFailedPointsTVPos = SearchPtr->TrackVectorPosition;
18413 IFE.
TVPos = NewFailedPointsTVPos;
18432 PointsChanged =
true;
18438 return(PointsChanged);
18462 NextForwardLinkedRouteNumber = -1;
18463 for(
unsigned int x = StartPos; x < PrefDirSize(); x++)
18465 int TrainID =
Track->
TrackElementAt(100, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnElement;
18466 if(PrefDirVector.at(x).TrackType ==
Bridge)
18468 if(PrefDirVector.at(x).XLinkPos < 2)
18470 TrainID =
Track->
TrackElementAt(101, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeOrFailedPointOrigSpeedLimit01;
18474 TrainID =
Track->
TrackElementAt(102, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeOrFailedPointOrigSpeedLimit23;
18482 if(PrefDirVector.at(x).TrackType ==
Buffers)
18494 if(
Track->
IsLCAtHV(42, PrefDirVector.at(x).HLoc, PrefDirVector.at(x).VLoc))
18503 if(PrefDirVector.at(x).Config[PrefDirVector.at(x).XLinkPos] ==
Signal)
18505 Attribute =
Track->
TrackElementAt(103, PrefDirVector.at(x).TrackVectorPosition).Attribute;
18517 if(x == PrefDirSize() - 1)
18520 NextForwardLinkedRouteNumber = -1;
18568 AnsiString(PrefDirVectorStartPosition));
18574 if(!PrefDirVector.empty())
18576 if(!SkipForwardLook)
18578 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr < PrefDirVector.end(); PrefDirPtr++)
18581 if(PrefDirPtr->TrackType ==
Bridge)
18583 if(PrefDirPtr->XLinkPos < 2)
18594 SkipForwardLook =
true;
18602 SkipForwardLook =
true;
18605 int NextForwardLinkedRouteNumber = -1;
18606 if((
unsigned int)PrefDirVectorStartPosition == PrefDirSize() - 1)
18608 TPrefDirElement PDE = GetFixedPrefDirElementAt(267, PrefDirVectorStartPosition);
18613 SkipForwardLook =
true;
18614 if(PrefDirVector.back().TrackType ==
Buffers)
18620 bool SetAttributeTo3 =
true;
18631 SetAttributeTo3 =
false;
18632 Attribute = AutoSigVectorIT->AccessNumber;
18638 if(SetAttributeTo3)
18649 SkipForwardLook =
true;
18650 if(PrefDirVector.back().TrackType ==
Buffers)
18663 if(!SkipForwardLook)
18668 if((
unsigned int)PrefDirVectorStartPosition < (PrefDirSize() - 1))
18670 StartPos = PrefDirVectorStartPosition + 1;
18678 if(!FindForwardTargetSignalAttribute(2, NextForwardLinkedRouteNumber, Attribute, StartPos))
18697 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr >= PrefDirVector.begin(); PrefDirPtr--)
18700 if(PrefDirPtr->TrackType ==
Bridge)
18702 if(PrefDirPtr->XLinkPos < 2)
18718 if(
Track->
IsLCAtHV(20, PrefDirPtr->HLoc, PrefDirPtr->VLoc))
18727 if(PrefDirPtr->Config[PrefDirPtr->XLinkPos] ==
Signal)
18729 if((!
AllRoutes->
RouteTruncateFlag) || (PrefDirPtr != (PrefDirVector.begin() + PrefDirVectorStartPosition)) || PrefDirPtr->AutoSignals ||
18730 PrefDirPtr->PrefDirRoute)
18734 int LockedVecNum = 0;
18736 bool KeepAttributeAt0ForLockedRoute =
false;
18741 KeepAttributeAt0ForLockedRoute =
true;
18746 bool NotGroundSignal =
false;
18749 NotGroundSignal =
true;
18774 if((Attribute < 3) && !KeepAttributeAt0ForLockedRoute && (NotGroundSignal || (Attribute == 0)))
18805 "," + AnsiString((
short)PrefDirRoute));
18806 bool ElementInRoute =
false;
18808 int LastElementToBeTruncated = -1;
18809 bool MovingTrainOccupyingRoute =
false;
18810 unsigned int TruncatePDElementPos;
18811 enum {NoTruncate, BackTruncate, FrontTruncate, NextSignalTruncate, FullTruncate} TruncateType;
18812 TruncateType = NoTruncate;
18819 TruncatePDElementPos = b;
18820 ElementInRoute =
true;
18824 if(!ElementInRoute)
18850 if(TruncatePDElementPos == 0)
18852 TruncateType = FullTruncate;
18863 TruncateType = FrontTruncate;
18871 TruncatePDElementPos++;
18874 for(b =
int(TruncatePDElementPos); b < int(
PrefDirSize()); b++)
18879 TruncateType = NextSignalTruncate;
18886 TruncateType = BackTruncate;
18892 TruncateType = BackTruncate;
18900 TruncateType = BackTruncate;
18906 if(TruncateType == BackTruncate)
18926 MovingTrainOccupyingRoute =
true;
18937 if(b ==
int(TruncatePDElementPos))
18943 else if(TruncateType == NextSignalTruncate)
18947 LastElementToBeTruncated = -1;
18948 for(
unsigned int b = TruncatePDElementPos; b <
PrefDirSize(); b++)
18953 LastElementToBeTruncated = int(b) - 1;
18957 for(
int b = LastElementToBeTruncated; b >= 0; b--)
18975 MovingTrainOccupyingRoute =
true;
18986 if(b ==
int(TruncatePDElementPos))
18992 ReinstatementRoute = *
this;
19001 else if(TruncateType == FrontTruncate)
19021 MovingTrainOccupyingRoute =
true;
19032 if(b == TruncatePDElementPos)
19058 MovingTrainOccupyingRoute =
true;
19079 if(((TruncatePDElementPos == 1) && (TruncateType == BackTruncate)) || ((TruncatePDElementPos == (
PrefDirSize() - 2)) && (TruncateType == FrontTruncate)))
19088 if((TruncatePDElementPos > 0) && (TruncateType == BackTruncate))
19095 TrainController->
StopTTClockMessage(145,
"Invalid green or blue route truncation position:\n\nto truncate from the start of the route select a position immediately before a facing signal "
19096 "that lies within the route;\n\nto truncate to the end of the route select a position immediately after a facing signal "
19097 "that lies within the route;\n\nto truncate to the next signal that isn't the end of the route select a signal to truncate from;\n\n"
19098 "or to remove the whole route select the first track element in the route");
19118 else if((TruncatePDElementPos < (
PrefDirSize() - 1)) && (TruncateType == FrontTruncate))
19125 TrainController->
StopTTClockMessage(146,
"Invalid green or blue route truncation position:\n\nto truncate from the start of the route select a position immediately before a facing signal "
19126 "that lies within the route;\n\nto truncate to the end of the route select a position immediately after a facing signal "
19127 "that lies within the route;\n\nto truncate to the next signal that isn't the end of the route select a signal to truncate from;\n\n"
19128 "or to remove the whole route select the first track element in the route");
19154 else if(TruncatePDElementPos == 0)
19161 TrainController->
StopTTClockMessage(148,
"Invalid green or blue route truncation position:\n\nto truncate from the start of the route select a position immediately before a facing signal "
19162 "that lies within the route;\n\nto truncate to the end of the route select a position immediately after a facing signal "
19163 "that lies within the route;\n\nto truncate to the next signal that isn't the end of the route select a signal to truncate from;\n\n"
19164 "or to remove the whole route select the first track element in the route");
19184 int ThisRouteNumber;
19194 if(LRVIT->RouteNumber == ThisRouteNumber)
19205 unsigned int LookBackwardsFromHere = 0;
19206 if((TruncateType == BackTruncate) || (TruncateType == NextSignalTruncate))
19208 LookBackwardsFromHere = TruncatePDElementPos;
19218 if(TruncateType == NextSignalTruncate)
19221 "immediately after the signal, this will lock the remainder of the route ");
19231 int button = Application->MessageBox(L
"Moving train approaching or occupying route, YES to lock route (2 minutes to release), NO to cancel",
19232 L
"Warning!", MB_YESNO | MB_ICONWARNING);
19245 bool ExistingLockedRouteModified =
false;
19247 if(TruncateType == BackTruncate)
19253 else if(TruncateType == FrontTruncate)
19274 if(LRVIT->RouteNumber == ThisRouteNumber)
19278 ExistingLockedRouteModified =
true;
19282 if(!ExistingLockedRouteModified)
19286 if(TruncateType == BackTruncate)
19289 RearPosition = TruncatePDElementPos;
19292 else if(TruncateType == FrontTruncate)
19296 FrontPosition = TruncatePDElementPos;
19305 for(
int c = FrontPosition; c >= RearPosition; c--)
19324 if((TruncateType == BackTruncate) || (TruncateType == NextSignalTruncate))
19326 RearPosition = TruncatePDElementPos;
19330 else if(TruncateType == FrontTruncate)
19333 FrontPosition = TruncatePDElementPos;
19350 for(
int c = FrontPosition; c >= RearPosition; c--)
19356 if(TruncateType == NextSignalTruncate)
19402 TPrefDirElement NewGreenFirstPDElement, NewRedFirstPDElement, NewGreenLastPDElement, NewRedLastPDElement;
19415 if(RouteColour == 1)
19417 NewRedFirstPDElement = LastPDElement;
19421 NewRedFirstPDElement.
IsARoute =
true;
19427 if(R2MMIt->second.first ==
int(x))
19429 R2MMIt->second.second++;
19436 else if(RouteColour == 2)
19438 NewGreenFirstPDElement = LastPDElement;
19442 NewGreenFirstPDElement.
IsARoute =
true;
19448 if(R2MMIt->second.first ==
int(x))
19450 R2MMIt->second.second++;
19473 if(RouteColour == 1)
19475 NewRedLastPDElement = FirstPDElement;
19484 else if(RouteColour == 2)
19486 NewGreenLastPDElement = FirstPDElement;
19555 ARVIt->SetRouteSignals(14);
19574 AnsiString((
short)PrefDirRoute));
19599 AnsiString((
short)PrefDirRoute));
19609 RouteFlashElement.
HLoc = H;
19610 RouteFlashElement.
VLoc = V;
19626 int H = PrefDirPtr->HLoc;
19627 int V = PrefDirPtr->VLoc;
19694 for(
unsigned int x = 0; x < RouteFlashVector.size(); x++)
19700 Display->
PlotOutput(21, RouteFlashVector.at(x).HLoc * 16, RouteFlashVector.at(x).VLoc * 16, RouteFlashVector.at(x).OriginalGraphic);
19703 OverlayPlotted =
false;
19726 bool FirstSignalFound =
false;
19733 if(PDVIt->TrackType ==
Points)
19735 if((PDVIt->ELinkPos == 1) || (PDVIt->XLinkPos == 1))
19746 else if((PDVIt->ELinkPos == 3) || (PDVIt->XLinkPos == 3))
19761 int XLinkPosition = PDVIt->XLinkPos;
19762 if(PDVIt->XLinkPos == -1)
19766 for(
int x = 0; x < 4; x++)
19768 if(PDVIt->Conn[x] == (PDVIt + 1)->TrackVectorPosition)
19781 if(XLinkPosition > -1)
19783 if(!FirstSignalFound && (PDVIt->Config[XLinkPosition] ==
Signal))
19785 FirstSignalFound =
true;
19788 else if(FirstSignalFound && (PDVIt->Config[XLinkPosition] ==
Signal))
19799 IFE.
TVPos = PDVIt->TrackVectorPosition;
19805 " failed when changing aspect.\nTrains can only pass under signaller control.");
19835 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
19837 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedRouteAt");
19840 return(AllRoutesVector.at(At));
19848 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
19850 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableRouteAt");
19853 return(AllRoutesVector.at(At));
19864 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
19866 GetFixedRouteAt(62, a).PrefDirMarker(7,
RouteCall,
false, Disp);
19876 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
19878 GetFixedRouteAt(166, a).RouteImageMarker(0, Bitmap);
19896 AnsiString(VLoc) +
"," + AnsiString((
short)PrefDirRoute));
19897 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
19901 GetModifiableRouteAt(7, a).TruncateRoute(0, HLoc, VLoc, PrefDirRoute, ReturnFlag);
19930 AnsiString(LinkPos));
19931 if(TrackVectorPosition == -1)
19936 THVPair Route2MultiMapKeyPair;
19940 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
19943 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
19953 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
19955 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
19958 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(64, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(88,
19959 Route2MultiMapIterator->second.second);
19960 EntryLinkPos = PrefDirElement1.
ELinkPos;
19961 ExitLinkPos = PrefDirElement1.
XLinkPos;
19962 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
19963 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
19975 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
19987 Graphics::TBitmap* &EntryDirectionGraphicPtr)
19997 AnsiString(LinkPos));
20000 if(TrackVectorPosition == -1)
20005 THVPair Route2MultiMapKeyPair;
20009 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
20012 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
20017 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
20019 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
20021 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(73, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(97,
20022 Route2MultiMapIterator->second.second);
20023 EntryLinkPos = PrefDirElement1.
ELinkPos;
20024 ExitLinkPos = PrefDirElement1.
XLinkPos;
20025 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
20026 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
20030 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(74,
20031 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
20038 return(AutoSigsRoute);
20043 return(NotAutoSigsRoute);
20049 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(75,
20050 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
20057 return(AutoSigsRoute);
20062 return(NotAutoSigsRoute);
20066 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
20068 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
20069 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
20071 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(76, ItPair.first->second.first).GetFixedPrefDirElementAt(98, ItPair.first->second.second);
20072 EntryLinkPos = PrefDirElement2.
ELinkPos;
20073 ExitLinkPos = PrefDirElement2.
XLinkPos;
20074 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
20075 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
20079 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(77, ItPair.first->second.first).PrefDirSize() - 1))
20086 return(AutoSigsRoute);
20091 return(NotAutoSigsRoute);
20097 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(78, ItPair.first->second.first).PrefDirSize() - 1))
20104 return(AutoSigsRoute);
20109 return(NotAutoSigsRoute);
20113 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(79, ItPair.second->second.first).GetFixedPrefDirElementAt(99, ItPair.second->second.second);
20114 EntryLinkPos = PrefDirElement3.
ELinkPos;
20115 ExitLinkPos = PrefDirElement3.
XLinkPos;
20116 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
20117 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
20121 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(80, ItPair.second->second.first).PrefDirSize() - 1))
20128 return(AutoSigsRoute);
20133 return(NotAutoSigsRoute);
20139 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(81, ItPair.second->second.first).PrefDirSize() - 1))
20146 return(AutoSigsRoute);
20151 return(NotAutoSigsRoute);
20167 AnsiString(LinkPos));
20168 if(TrackVectorPosition == -1)
20174 THVPair Route2MultiMapKeyPair;
20178 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
20181 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
20187 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
20189 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
20191 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(82, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(100,
20192 Route2MultiMapIterator->second.second);
20193 EntryLinkPos = PrefDirElement1.
ELinkPos;
20194 ExitLinkPos = PrefDirElement1.
XLinkPos;
20195 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
20196 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
20199 RouteNumber = Route2MultiMapIterator->second.first;
20203 return(AutoSigsRoute);
20208 return(NotAutoSigsRoute);
20213 RouteNumber = Route2MultiMapIterator->second.first;
20217 return(AutoSigsRoute);
20222 return(NotAutoSigsRoute);
20226 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
20228 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
20229 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
20231 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(83, ItPair.first->second.first).GetFixedPrefDirElementAt(101, ItPair.first->second.second);
20232 EntryLinkPos = PrefDirElement2.
ELinkPos;
20233 ExitLinkPos = PrefDirElement2.
XLinkPos;
20234 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
20235 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
20238 RouteNumber = ItPair.first->second.first;
20242 return(AutoSigsRoute);
20247 return(NotAutoSigsRoute);
20252 RouteNumber = ItPair.first->second.first;
20256 return(AutoSigsRoute);
20261 return(NotAutoSigsRoute);
20265 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(84, ItPair.second->second.first).GetFixedPrefDirElementAt(102, ItPair.second->second.second);
20266 EntryLinkPos = PrefDirElement3.
ELinkPos;
20267 ExitLinkPos = PrefDirElement3.
XLinkPos;
20268 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
20269 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
20272 RouteNumber = ItPair.second->second.first;
20276 return(AutoSigsRoute);
20281 return(NotAutoSigsRoute);
20286 RouteNumber = ItPair.second->second.first;
20290 return(AutoSigsRoute);
20295 return(NotAutoSigsRoute);
20317 EmptyRoute.
RouteID = NextRouteID;
20320 AllRoutesVector.push_back(EmptyRoute);
20321 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
20345 AllRoutesVector.push_back(EmptyRoute);
20346 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
20369 THVPair Route2MultiMapKeyPair;
20378 LockedRouteRearTrackVectorPosition = 0;
20379 LockedRouteLastTrackVectorPosition = 0;
20380 LockedRouteLastXLinkPos = 0;
20381 LockedRouteLockStartTime = TDateTime(0);
20382 if(!LockedRouteVector.empty())
20386 if(LRVIT->RouteNumber == RouteNumber)
20388 LockedRouteRearTrackVectorPosition = LRVIT->RearTrackVectorPosition;
20389 LockedRouteLastTrackVectorPosition = LRVIT->LastTrackVectorPosition;
20390 LockedRouteLastXLinkPos = LRVIT->LastXLinkPos;
20391 LockedRouteLockStartTime = LRVIT->LockStartTime;
20392 LockedRouteFoundDuringRouteBuilding =
true;
20393 LockedRouteVector.erase(LRVIT);
20418 AnsiString(VLoc) +
"," + AnsiString(ELink));
20421 ReturnPair.first = -1;
20422 ReturnPair.second = 0;
20423 THVPair Route2MultiMapKeyPair;
20425 Route2MultiMapKeyPair.first = HLoc;
20426 Route2MultiMapKeyPair.second = VLoc;
20429 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
20430 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
20432 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
20433 Route2MultiMapIterator = ItPair.first;
20435 if(ItPair.first == ItPair.second)
20437 throw Exception(
"Failed to find Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc);
20439 if(GetFixedRouteAt(111, ItPair.first->second.first).GetFixedPrefDirElementAt(132, ItPair.first->second.second).GetELink() == ELink)
20441 ReturnPair.first = ItPair.first->second.first;
20442 ReturnPair.second = ItPair.first->second.second;
20443 Route2MultiMapIterator = ItPair.first;
20445 return(ReturnPair);
20448 if(ItPair.first == ItPair.second)
20450 throw Exception(
"Found Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc +
" but failed to find required element");
20452 if(GetFixedRouteAt(112, ItPair.first->second.first).GetFixedPrefDirElementAt(133, ItPair.first->second.second).GetELink() == ELink)
20454 ReturnPair.first = ItPair.first->second.first;
20455 ReturnPair.second = ItPair.first->second.second;
20456 Route2MultiMapIterator = ItPair.first;
20458 return(ReturnPair);
20461 return(ReturnPair);
20476 AnsiString(VLoc) +
"," + AnsiString(ELink));
20477 THVPair Route2MultiMapKeyPair;
20479 Route2MultiMapKeyPair.first = HLoc;
20480 Route2MultiMapKeyPair.second = VLoc;
20481 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
20483 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
20485 if(ItPair.first == ItPair.second)
20491 if(GetFixedRouteAt(205, ItPair.first->second.first).GetFixedPrefDirElementAt(241, ItPair.first->second.second).GetELink() == ELink)
20493 RouteNumber = ItPair.first->second.first;
20499 if(ItPair.first == ItPair.second)
20505 if(GetFixedRouteAt(206, ItPair.first->second.first).GetFixedPrefDirElementAt(242, ItPair.first->second.second).GetELink() == ELink)
20507 RouteNumber = ItPair.first->second.first;
20528 "," + AnsiString(ELinkIn) +
"," + AnsiString(RouteNumber) +
"," + AnsiString(RouteElementNumber));
20529 THVPair Route2MultiMapKeyPair;
20531 Route2MultiMapKeyPair.first = HLoc;
20532 Route2MultiMapKeyPair.second = VLoc;
20535 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
20538 RouteElementPair.first = RouteNumber;
20539 RouteElementPair.second = RouteElementNumber;
20540 Route2MultiMapEntry.second = RouteElementPair;
20542 if(Route2MultiMap.find(Route2MultiMapKeyPair) != Route2MultiMap.end())
20545 if(GetFixedRouteAt(113, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(134,
20546 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).GetELink() != ELinkIn)
20549 if(GetFixedRouteAt(114, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(135,
20550 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).TrackType !=
Bridge)
20552 throw Exception(
"Error, bridge expected in Route2MultiMapInsert but not, at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
20554 Route2MultiMap.insert(Route2MultiMapEntry);
20559 throw Exception(
"Error, route map entry found in Route2MultiMapInsert at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
20564 Route2MultiMap.insert(Route2MultiMapEntry);
20582 TempPair.first = -1;
20583 TempPair.second = 0;
20584 SecondPair = TempPair;
20586 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItRange;
20587 THVPair Route2MultiMapKeyPair;
20589 Route2MultiMapKeyPair.first = HLoc;
20590 Route2MultiMapKeyPair.second = VLoc;
20591 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
20596 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
20598 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
20600 return(Route2MultiMapIterator->second);
20602 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
20604 ItRange = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
20605 TempPair = ItRange.first->second;
20606 SecondPair = (--ItRange.second)->second;
20629 TRouteElementPair RouteElementPair = GetRouteElementDataFromRoute2MultiMap(8, CheckElement.
HLoc, CheckElement.
VLoc, SecondPair);
20630 if(RouteElementPair.first == -1)
20633 throw Exception(
"CheckMapAndRoutes Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
20634 " in Route2MultiMap, Caller=" + (AnsiString)Caller);
20636 if((RouteElementPair.first != (
int)a) && (SecondPair.first != (
int)a))
20639 throw Exception(
"CheckMapAndRoutes Error - RouteNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
20640 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)RouteElementPair.first +
" Route value=" + (AnsiString)a +
" Caller=" +
20641 (AnsiString)Caller);
20643 if(((RouteElementPair.first != (
int)a) || (RouteElementPair.second != b)) && ((SecondPair.first != (
int)a) || (SecondPair.second != b)))
20646 throw Exception(
"CheckMapAndRoutes Error - PrefDirVectorNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
20647 (AnsiString)CheckElement.
VLoc +
" 1st Map value RouteNum/ElementNum =" + (AnsiString)RouteElementPair.first +
"/" +
20648 (AnsiString)RouteElementPair.second +
" 2nd Map value =" + (AnsiString)SecondPair.first +
"/" + (AnsiString)SecondPair.second +
20649 " Route value=" + (AnsiString)a +
"/" + (AnsiString)b +
" Caller=" + (AnsiString)Caller);
20653 unsigned int SizeVal = 0;
20656 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
20658 SizeVal += GetFixedRouteAt(117, a).PrefDirSize();
20660 if(SizeVal != Route2MultiMap.size())
20662 throw Exception(
"CheckMapAndRoutes Error - Map Size=" + (AnsiString)Route2MultiMap.size() +
" RouteSize=" + (AnsiString)SizeVal +
" Caller=" +
20663 (AnsiString)Caller);
20679 if(!Route2MultiMap.empty())
20681 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
20683 if(Route2MultiMapIterator->second.first > RouteNumber)
20685 Route2MultiMapIterator->second.first--;
20702 AnsiString(RouteNumber) +
"," + AnsiString(ErasedElementNumber));
20703 if(!Route2MultiMap.empty())
20705 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
20707 if((Route2MultiMapIterator->second.first == RouteNumber) && (Route2MultiMapIterator->second.second > ErasedElementNumber))
20709 Route2MultiMapIterator->second.second--;
20728 AnsiString(ELink));
20732 RequiredRoutePair = FindRoutePairFromRoute2MultiMap(0, HLoc, VLoc, ELink, Route2MultiMapIterator);
20733 if(RequiredRoutePair.first == -1)
20735 throw Exception(
"Failed to find route element in RemoveRouteElement");
20737 Route2MultiMap.erase(Route2MultiMapIterator);
20738 DecrementRouteElementNumbersInRoute2MultiMap(0, RequiredRoutePair.first, RequiredRoutePair.second);
20741 TPrefDirElement LockedRouteElement, PrefDirElement = GetFixedRouteAt(118, RequiredRoutePair.first).GetFixedPrefDirElementAt(137, RequiredRoutePair.second);
20762 GetModifiableRouteAt(8, RequiredRoutePair.first).PrefDirVector.erase(GetModifiableRouteAt(33, RequiredRoutePair.first).PrefDirVector.begin() + RequiredRoutePair.second);
20773 if(AutoSigVectorIT->RouteNumber == RequiredRoutePair.first)
20781 if(GetModifiableRouteAt(10, RequiredRoutePair.first).PrefDirSize() == 0)
20783 TrainController->
LogEvent(
"RouteRemoved," + AnsiString(GetFixedRouteAt(189, RequiredRoutePair.first).RouteID));
20784 AllRoutesVector.erase(AllRoutesVector.begin() + RequiredRoutePair.first);
20785 DecrementRouteNumbersInRoute2MultiMap(0, RequiredRoutePair.first);
20797 if(!LockedRouteVector.empty())
20801 if(LRVIT->RouteNumber > RequiredRoutePair.first)
20803 LRVIT->RouteNumber--;
20813 if(AutoSigVectorIT->RouteNumber > RequiredRoutePair.first)
20815 AutoSigVectorIT->RouteNumber--;
20820 CheckMapAndRoutes(7);
20834 AnsiString(ELink) +
"," + AnsiString(RouteNumber) +
"," + RouteElement.
LogPrefDir());
20835 GetModifiableRouteAt(11, RouteNumber).StoreRouteElementInPrefDirVector(RouteElement);
20836 Route2MultiMapInsert(0, HLoc, VLoc, ELink, RouteNumber, GetModifiableRouteAt(12, RouteNumber).
PrefDirSize() - 1);
20853 "," + AnsiString(XLinkPos));
20857 RouteElementPair = GetRouteElementDataFromRoute2MultiMap(9, TE.
HLoc, TE.
VLoc, SecondPair);
20858 if(RouteElementPair.first == -1)
20860 throw Exception(
"Error, failed to find element in SetTrailingSignalsOnAutoSigsRoute - 1");
20862 TPrefDirElement RouteElement = GetFixedRouteAt(119, RouteElementPair.first).GetFixedPrefDirElementAt(138, RouteElementPair.second);
20864 RequiredPair = RouteElementPair;
20865 if(RouteElement.
XLinkPos != XLinkPos)
20867 if(SecondPair.first != -1)
20869 RouteElement = GetFixedRouteAt(120, SecondPair.first).GetFixedPrefDirElementAt(139, SecondPair.second);
20870 RequiredPair = SecondPair;
20871 if(RouteElement.
XLinkPos != XLinkPos)
20873 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 2");
20878 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 3");
20882 SetAllRearwardsSignals(5, 0, RequiredPair.first, RequiredPair.second);
20903 AnsiString(AccessNumber));
20905 int Attribute = AccessNumber;
20907 int x = GetFixedRouteAt(121, RouteNumber).PrefDirSize() - 1;
20911 throw Exception(
"Error - route not AutoSignals in SetTrailingSignalsOnContinuationRoute");
20915 throw Exception(
"Error - end element not continuation in SetTrailingSignalsOnContinuationRoute");
20918 x).XLinkPos] !=
End)
20920 throw Exception(
"Error - end element a continuation in SetTrailingSignalsOnContinuationRoute but End not facing right way");
20923 SetAllRearwardsSignals(6, Attribute, RouteNumber, GetFixedRouteAt(126, RouteNumber).
PrefDirSize() - 1);
20974 AnsiString(RouteNumber) +
"," + AnsiString(RouteStartPosition));
20975 TPrefDirElement FirstElement = GetFixedRouteAt(127, RouteNumber).GetFixedPrefDirElementAt(144, 0);
20976 int RearwardLinkedRouteNumber;
20979 bool SkipForwardLook =
false;
20988 SkipForwardLook =
true;
20990 RearwardLinkedRouteNumber).
PrefDirSize() - 1, SkipForwardLook)))
21000 int TrainID, TrainPosition, BehindTrainPosition;
21001 bool FoundTrain =
false, BehindTrain =
false;
21002 for(
int x = RouteStartPosition; x >= 0; x--)
21004 TPrefDirElement PrefDirElement = GetFixedRouteAt(132, RouteNumber).GetFixedPrefDirElementAt(146, x);
21029 if(FoundTrain && (TrainPosition > 1))
21033 for(
int x = TrainPosition; x >= 0; x--)
21037 TPrefDirElement PrefDirElement = GetFixedRouteAt(133, RouteNumber).GetFixedPrefDirElementAt(147, x);
21057 BehindTrain =
true;
21058 BehindTrainPosition = x;
21065 SetAllRearwardsSignals(7, 0, RouteNumber, BehindTrainPosition);
21082 AnsiString(LookBackwardsFromHere));
21083 int SignalCount = 0, TrainID, RearwardLinkedRouteNumber;
21084 TOneRoute CurrentRoute = GetFixedRouteAt(134, RouteNumber);
21087 bool ExamineRoute =
true;
21089 while(ExamineRoute)
21091 for(
int x = LookBackwardsFromHere; x >= 0; x--)
21136 if(SignalCount >= 3)
21151 LookBackwardsFromHere = CurrentRoute.
PrefDirSize() - 1;
21155 CurrentRoute = GetFixedRouteAt(135, RearwardLinkedRouteNumber);
21156 ExamineRoute =
true;
21157 LookBackwardsFromHere = GetFixedRouteAt(136, RearwardLinkedRouteNumber).PrefDirSize() - 1;
21192 ExamineRoute =
false;
21207 AnsiString(TrackVectorPosition) +
"," + AnsiString(XLinkPos));
21210 PrefDirElement = InternalPrefDirElement;
21211 if(LockedRouteVector.empty())
21218 bool InLockedRoute =
false;
21222 if(TrackIsInARoute(14, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos))
21226 InLockedRoute =
true;
21235 int RouteNumber, VectorCount = 0;
21240 RouteType = GetRouteTypeAndNumber(8, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos, RouteNumber);
21241 if(RouteType == NoRoute)
21254 for(
int x = GetFixedRouteAt(141, RouteNumber).
PrefDirSize() - 1; x >= 0; x--)
21256 InternalPrefDirElement = GetFixedRouteAt(142, RouteNumber).GetFixedPrefDirElementAt(152, x);
21261 PrefDirElement = InternalPrefDirElement;
21262 LockedVectorNumber = VectorCount;
21267 else if(InternalPrefDirElement.
TrackVectorPosition == (
int)LRVIT->RearTrackVectorPosition)
21271 PrefDirElement = InternalPrefDirElement;
21272 LockedVectorNumber = VectorCount;
21293 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
21295 if(GetFixedRouteAt(157, x).RouteID ==
RouteID.GetInt())
21301 throw Exception(
"Error, failed to find RouteID in GetRouteVectorNumber for ID: " + AnsiString(
RouteID.GetInt()));
21311 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
21313 if(GetFixedRouteAt(45, x).RouteID ==
RouteID.GetInt())
21328 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
21330 if(GetFixedRouteAt(163, x).RouteID ==
RouteID.GetInt())
21333 return(GetFixedRouteAt(159, x));
21336 throw Exception(
"Error, failed to find RouteID in GetFixedRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
21344 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
21346 if(GetFixedRouteAt(164, x).RouteID ==
RouteID.GetInt())
21349 return(GetModifiableRouteAt(15, x));
21352 throw Exception(
"Error, failed to find RouteID in GetModifiableRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
21362 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
21364 TOneRoute OneRoute = GetFixedRouteAt(165, x);
21376 int NumberOfRoutes;
21380 for(
int x = 0; x < NumberOfRoutes; x++)
21387 StoreOneRouteAfterSessionLoad(0, &OneRoute);
21405 if((NumberOfRoutes < 0) || (NumberOfRoutes > 10000))
21412 if((NextID < 0) || (NextID > 1000000))
21417 for(
int x = 0; x < NumberOfRoutes; x++)
21442 AnsiString(StartPosition));
21443 if(EndPosition == StartPosition)
21449 int TVPos = EndPosition;
21450 int LkPos = EndXLinkPos;
21452 while(TrackIsInARoute(15, TVPos, LkPos))
21479 if(GetRouteTypeAndNumber(36, NewTVPos, NewLkPos, RouteNumber) == NoRoute)
21488 if((NewLkPos == 0) || (NewLkPos == 2))
21508 if(TVPos == StartPosition)
21540 AnsiString(VLoc) +
"," + AnsiString(DiagonalLinkNumber));
21545 if(FirstPair.first > -1)
21548 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
21553 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21559 if(SecondPair.first > -1)
21562 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
21567 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21573 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(0, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(1, HLoc - 1, VLoc,
21580 if(FirstPair.first > -1)
21583 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21588 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21594 if(SecondPair.first > -1)
21597 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21602 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21608 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(2, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(3, HLoc, VLoc - 1,
21615 if(FirstPair.first > -1)
21618 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21623 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21629 if(SecondPair.first > -1)
21632 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21637 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21643 if(((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(4, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(5, HLoc + 1, VLoc,
21650 if(FirstPair.first > -1)
21653 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21658 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
21664 if(SecondPair.first > -1)
21667 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21672 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
21678 if(((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(6, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(7, HLoc, VLoc + 1,
21702 "," + AnsiString(DiagonalLinkNumber));
21707 if(FirstPair.first > -1)
21710 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
21715 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21721 if(SecondPair.first > -1)
21724 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
21729 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21736 if(FirstPair.first > -1)
21739 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21744 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21750 if(SecondPair.first > -1)
21753 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21758 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21765 if(FirstPair.first > -1)
21768 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21773 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21779 if(SecondPair.first > -1)
21782 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21787 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21794 if(FirstPair.first > -1)
21797 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21802 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
21808 if(SecondPair.first > -1)
21811 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21816 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))